- Notifications
You must be signed in to change notification settings - Fork 909
/
Copy pathtip-color-range.py
24 lines (19 loc) · 718 Bytes
/
tip-color-range.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# -----------------------------------------------------------------------------
# Matplotlib cheat sheet
# Released under the BSD License
# -----------------------------------------------------------------------------
# Scripts to generate all the basic plots
importnumpyasnp
importmatplotlibasmpl
importmatplotlib.pyplotasplt
fig=plt.figure(figsize=(2,2))
mpl.rcParams['axes.linewidth'] =1.5
d=0.01
ax=fig.add_axes([d,d,1-2*d,1-2*d], xticks=[], yticks=[])
X=np.random.seed(1)
X=np.random.randn(1000, 4)
cmap=plt.get_cmap("Blues")
colors= [cmap(i) foriin [.2,.4,.6,.8]]
ax.hist(X, 2, density=True, histtype='bar', color=colors)
plt.savefig("../figures/tip-color-range.pdf")
# plt.show()