Issue
I try to change the font size of the ticks on colorbar. It is not the x or y axis ticks; but, the ticks of the "color bar" appeared on the right side of the plt.pcolor plot.
I searched online, and found a couple of suggestions, e.g.,
plt.figure(figsize=(8, 6), dpi=150)
cbar = plt.pcolor(x, y, z, cmap='jet')
cbar.ax.set_yticklabels(cbar.ax.get_yticklabels(), fontsize=20)
But, it does not change the tick font size of the colorbar.
I appreciate any suggestions.
Solution
Exactly how you would do it for a normal axis (at least for 3.4.3)
fig, ax = plt.subplots()
pc = ax.pcolormesh(np.random.randn(20, 20))
cb = fig.colorbar(pc)
cb.ax.tick_params(axis='y', which='major', labelsize=16)
plt.show()
Answered By - Jody Klymak
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.