- Notifications
You must be signed in to change notification settings - Fork 908
/
Copy pathtip-colorbar.py
30 lines (23 loc) · 880 Bytes
/
tip-colorbar.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
30
# -----------------------------------------------------------------------------
# Matplotlib cheat sheet
# Released under the BSD License
# -----------------------------------------------------------------------------
# Scripts to generate all the basic plots
importpathlib
importnumpyasnp
importmatplotlibasmpl
importmatplotlib.pyplotasplt
importmatplotlib.patheffectsaspath_effects
ROOT_DIR=pathlib.Path(__file__).parent.parent
fig=plt.figure(figsize=(2.15, 2))
mpl.rcParams['axes.linewidth'] =1.5
d=0.01
ax=fig.add_axes([d, d, 1-2*d, 1-2*d], xticks=[], yticks=[])
np.random.seed(1)
Z=np.random.uniform(0, 1, (8, 8))
cmap=plt.get_cmap("Oranges")
im=ax.imshow(Z, interpolation="nearest", cmap=cmap, vmin=0, vmax=2)
cb=fig.colorbar(im, fraction=0.046, pad=0.04)
cb.set_ticks([])
fig.savefig(ROOT_DIR/"figures/tip-colorbar.pdf")
# plt.show()