I am creating a 2D plot with a colorbar. The values in the colorbar are very small, therefore I am using scientific notation. When I want to change the tick sizes of the colorbar the size of text which gives the information about the power of the colorbar is not adjusted. How can I change this?
Here is a minimal example
import numpy as np
import matplotlib.pyplot as plt
x = np.random.rand(100)
y = np.random.rand(100)
z = np.random.rand(100)*0.001
x=x.reshape((10,10))
y=y.reshape((10,10))
z=z.reshape((10,10))
fig, ax = plt.subplots(figsize=(8,6))
cs = ax.contourf(x,y,z, 10)
plt.xticks(fontsize=16,rotation=0)
plt.yticks(fontsize=16,rotation=0)
cbar = plt.colorbar(cs,)
cbar.set_label("test",fontsize = 22)
cbar.formatter.set_scientific(True)
cbar.formatter.set_powerlimits((0, 0))
cbar.ax.tick_params(labelsize=16)
cbar.update_ticks()
plt.savefig("test.png")
which produces the following output: