Change fontsize of colorbars in matplotlib
If I use @Yugi's answer, I will get latex errors. You can also set the fontsize with:
ticklabs = cbar.ax.get_yticklabels()
cbar.ax.set_yticklabels(ticklabs, fontsize=10)
use cbar.ax.tick_params(labelsize=10)
From here and here