- Notifications
You must be signed in to change notification settings - Fork 908
/
Copy pathtip-color-range.py
29 lines (21 loc) · 800 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
25
26
27
28
29
# -----------------------------------------------------------------------------
# Matplotlib cheat sheet
# Released under the BSD License
# -----------------------------------------------------------------------------
# Scripts to generate all the basic plots
importpathlib
importnumpyasnp
importmatplotlibasmpl
importmatplotlib.pyplotasplt
ROOT_DIR=pathlib.Path(__file__).parent.parent
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("Oranges")
colors= [cmap(i) foriin [.1, .3, .5, .7]]
ax.hist(X, 2, density=True, histtype='bar', color=colors)
fig.savefig(ROOT_DIR/"figures/tip-color-range.pdf")
# plt.show()