To change imshow colorbar label size in matplotlib, there is the tick_params function, example
#!/usr/bin/env pythonimport numpy as npimport matplotlib.pyplot as pltdef f(x,y):return (x+y)*np.exp(-5.0*(x**2+y**2))x,y = np.mgrid[-1:1:100j, -1:1:100j]z = f(x,y)plt.imshow(z,extent=[-1,1,-1,1])cb = plt.colorbar()cb.ax.tick_params(labelsize=7)plt.savefig("imshow_colorbar_labelsize_02.png")plt.show()
References
| Links | Site |
|---|---|
| tick_params | matplotlib.org |
| matplotlib.pyplot.imshow | matplotlib.org |
| Python matplotlib decrease size of colorbar labels | stackoverflow |
