You are reading documentation for the unreleased version of Matplotlib. Try searching for the released version of this page instead?
Version 2.1.1.post1076+g937889f
Fork me on GitHub

Related Topics

This Page

Demo New ColorbarΒΆ

import matplotlib.pyplot as plt
from mpl_toolkits.axes_grid1.colorbar import colorbar

plt.rcParams["text.usetex"] = False

fig, (ax1, ax2) = plt.subplots(1, 2, figsize=(6, 3))

im1 = ax1.imshow([[1, 2], [3, 4]])
cb1 = fig.colorbar(im1, ax=ax1)[1, 3])
ax1.set_title("Original MPL's colorbar w/\nset_yticks([1,3])", size=10)

im2 = ax2.imshow([[1, 2], [3, 4]])
cb2 = colorbar(im2, ax=ax2)[1, 3])
ax2.set_title("AxesGrid's colorbar w/\nset_yticks([1,3])", size=10)

Gallery generated by Sphinx-Gallery