You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
JD Russo edited this page Dec 15, 2021
·
1 revision
Matplotlib
Display colorbars for subplots
When dealing with a single set of color-mappable data, you can just call plt.colorbar(), but when using subplots, the colorbar needs to get its own axis. Meaning, you'd need to create an extra subplot just for the colorbar, that's of the right size.
This creates a subplot w/ 2 columns. In each column, a heatmap is plotted with imshow, and then a new axis is added for the colobar, that's 5% the width of the subplot.