Arg. It's always the last thing you try:
quadmesh.set_clim(vmin=0, vmax=15)
works.
Answer from mgilson on Stack OverflowMatplotlib
matplotlib.org › stable › api › _as_gen › matplotlib.pyplot.clim.html
matplotlib.pyplot.clim — Matplotlib 3.11.2 documentation
If you want to set the clim of multiple images, use set_clim on every image, for example:
Matplotlib
matplotlib.org › 2.1.1 › api › _as_gen › matplotlib.pyplot.clim.html
matplotlib.pyplot.clim — Matplotlib 2.1.1 documentation
To apply clim to all axes images do: clim(0, 0.5) If either vmin or vmax is None, the image min/max respectively will be used for color scaling. If you want to set the clim of multiple images, use, for example: for im in gca().get_images(): im.set_clim(0, 0.05) Animation Demo ·
Matplotlib
matplotlib.org › 3.1.1 › api › _as_gen › matplotlib.pyplot.clim.html
matplotlib.pyplot.clim — Matplotlib 3.1.2 documentation
May 1, 2020 - If you want to set the clim of multiple images, use set_clim on every image, for example: ... © Copyright 2002 - 2012 John Hunter, Darren Dale, Eric Firing, Michael Droettboom and the Matplotlib development team; 2012 - 2018 The Matplotlib development team. Last updated on Jan 05, 2020.
Top answer 1 of 3
40
Arg. It's always the last thing you try:
quadmesh.set_clim(vmin=0, vmax=15)
works.
2 of 3
4
Matplotlib 1.3.1 - It looks like the colorbar ticks are only drawn when the colorbar is instanced. Changing the colorbar limits (set_clim) does not cause the ticks to be re-drawn.
The solution I found was to re-instance the colorbar in the same axes entry as the original colorbar. In this case, axes[1] was the original colorbar. Added a new instance of the colorbar with this designated with the cax= (child axes) kwarg.
# Reset the Z-axis limits
print "resetting Z-axis plot limits", self.zmin, self.zmax
self.cbar = self.fig.colorbar(CS1, cax=self.fig.axes[1]) # added
self.cbar.set_clim(self.zmin, self.zmax)
self.cbar.draw_all()
Matplotlib
matplotlib.org › 3.2.1 › api › _as_gen › matplotlib.pyplot.clim.html
matplotlib.pyplot.clim — Matplotlib 3.2.1 documentation
April 8, 2020 - If you want to set the clim of multiple images, use set_clim on every image, for example:
Matplotlib
matplotlib.org › 3.1.0 › api › _as_gen › matplotlib.pyplot.clim.html
matplotlib.pyplot.clim — Matplotlib 3.1.0 documentation
May 18, 2019 - If you want to set the clim of multiple images, use set_clim on every image, for example: ... © Copyright 2002 - 2012 John Hunter, Darren Dale, Eric Firing, Michael Droettboom and the Matplotlib development team; 2012 - 2018 The Matplotlib development team. Last updated on May 18, 2019.
GitHub
github.com › matplotlib › matplotlib › issues › 12682
using AxesImage.set_clim() shrinks the colorbar · Issue #12682 · matplotlib/matplotlib
October 31, 2018 - fig, ax = plt.subplots() data = np.random.random(size=(50,50)) img = ax.imshow(data) cb = plt.colorbar(img) # the colorbar is the same height as the plot at this point #img.set_clim([0.25,0.75]) # running this line will produce a shrunken colorbar #img.set_clim([-0.25,1.25]) # running this line will change the limits of the colorbar # and return the colorbar to its original size
Matplotlib
matplotlib.org › devdocs › api › _as_gen › matplotlib.pyplot.clim.html
matplotlib.pyplot.clim — Matplotlib 3.11.0.dev2038+g7820a63f8 documentation
If you want to set the clim of multiple images, use set_clim on every image, for example:
Matplotlib
matplotlib.org › 3.3.4 › api › _as_gen › matplotlib.pyplot.clim.html
matplotlib.pyplot.clim — Matplotlib 3.3.4 documentation
If you want to set the clim of multiple images, use set_clim on every image, for example:
Jklymak
jklymak.github.io › matplotlib.github.com › stable › api › _as_gen › matplotlib.pyplot.clim.html
matplotlib.pyplot.clim — Matplotlib 3.3.3 documentation
If you want to set the clim of multiple images, use set_clim on every image, for example:
Matplotlib
matplotlib.org › 3.5.0 › api › _as_gen › matplotlib.pyplot.clim.html
matplotlib.pyplot.clim — Matplotlib 3.5.0 documentation
January 5, 2020 - If you want to set the clim of multiple images, use set_clim on every image, for example:
Matplotlib
matplotlib.org › 2.1.0 › api › _as_gen › matplotlib.pyplot.clim.html
matplotlib.pyplot.clim — Matplotlib 2.1.0 documentation
To apply clim to all axes images do: clim(0, 0.5) If either vmin or vmax is None, the image min/max respectively will be used for color scaling. If you want to set the clim of multiple images, use, for example: for im in gca().get_images(): im.set_clim(0, 0.05) Animation Demo ·
Matplotlib
matplotlib.org › 2.1.2 › api › _as_gen › matplotlib.pyplot.clim.html
matplotlib.pyplot.clim — Matplotlib 2.1.2 documentation
To apply clim to all axes images do: clim(0, 0.5) If either vmin or vmax is None, the image min/max respectively will be used for color scaling. If you want to set the clim of multiple images, use, for example: for im in gca().get_images(): im.set_clim(0, 0.05) Animation Demo ·
Matplotlib
matplotlib.org › 3.3.0 › api › _as_gen › matplotlib.pyplot.clim.html
matplotlib.pyplot.clim — Matplotlib 3.3.0 documentation
July 17, 2020 - If you want to set the clim of multiple images, use set_clim on every image, for example:
Matplotlib
matplotlib.org › 2.2.0 › api › _as_gen › matplotlib.pyplot.clim.html
matplotlib.pyplot.clim — Matplotlib 2.2.0 documentation
for im in gca().get_images(): im.set_clim(0, 0.05) © Copyright 2002 - 2012 John Hunter, Darren Dale, Eric Firing, Michael Droettboom and the Matplotlib development team; 2012 - 2017 The Matplotlib development team. Last updated on Mar 06, 2018.
Matplotlib
matplotlib.org › 3.1.3 › api › _as_gen › matplotlib.pyplot.clim.html
matplotlib.pyplot.clim — Matplotlib 3.1.3 documentation
If you want to set the clim of multiple images, use set_clim on every image, for example: ... © Copyright 2002 - 2012 John Hunter, Darren Dale, Eric Firing, Michael Droettboom and the Matplotlib development team; 2012 - 2018 The Matplotlib development team. Last updated on Feb 09, 2020.
Matplotlib
matplotlib.org › 3.3.1 › api › _as_gen › matplotlib.pyplot.clim.html
matplotlib.pyplot.clim — Matplotlib 3.3.1 documentation
August 14, 2020 - If you want to set the clim of multiple images, use set_clim on every image, for example:
Matplotlib
matplotlib.org › 3.3.2 › api › _as_gen › matplotlib.pyplot.clim.html
matplotlib.pyplot.clim — Matplotlib 3.3.2 documentation
September 15, 2020 - If you want to set the clim of multiple images, use set_clim on every image, for example: