How to change imshow colorbar label size in matplotlib


To change imshow colorbar label size in matplotlib, there is the tick_params function, example

How to change imshow colorbar label size in matplotlib How to change imshow colorbar label size in matplotlib
How to change imshow colorbar label size in matplotlib

#!/usr/bin/env python

import numpy as np
import matplotlib.pyplot as plt

def 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