If you didn't keep the returned image object, you can use pylab.gci to get the current ScalarMappable (i.e. whatever the current colorbar would be based on).

From there, you just want the get_clim method of the ScalarMappable object.

So, you could do:

vmin, vmax = plt.gci().get_clim()
Answer from Joe Kington on Stack Overflow
🌐
Matplotlib
matplotlib.org › stable › api › _as_gen › matplotlib.pyplot.clim.html
matplotlib.pyplot.clim — Matplotlib 3.11.2 documentation
matplotlib.pyplot.clim(vmin=None, vmax=None)[source]# Set the color limits of the current image. If either vmin or vmax is None, the image min/max respectively will be used for color scaling.
🌐
Matplotlib
matplotlib.org › 2.1.1 › api › _as_gen › matplotlib.pyplot.clim.html
matplotlib.pyplot.clim — Matplotlib 2.1.1 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 Dec 11, 2017.
🌐
GeeksforGeeks
geeksforgeeks.org › python › matplotlib-pyplot-clim-in-python
Matplotlib.pyplot.clim() in Python - GeeksforGeeks
July 12, 2025 - # Implementation of matplotlib function import matplotlib.pyplot as plt import numpy as np from matplotlib.colors import LogNorm dx, dy = 0.015, 0.05 y, x = np.mgrid[slice(-4, 4 + dy, dy), slice(-4, 4 + dx, dx)] z = (1 - x / 3. + x ** 5 + y ** 5) * np.exp(-x ** 2 - y ** 2) z = z[:-1, :-1] z_min, z_max = -np.abs(z).max(), np.abs(z).max() im = plt.imshow(z, cmap ='Greens', vmin = z_min, vmax = z_max, extent = [x.min(), x.max(), y.min(), y.max()], interpolation ='nearest', origin ='lower') plt.clim(vmin = 0, vmax = 2) plt.title('matplotlib.pyplot.clim Example') plt.show() Output: Example 2:
🌐
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.
🌐
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.
🌐
Matplotlib
matplotlib.org › 3.2.1 › api › _as_gen › matplotlib.pyplot.clim.html
matplotlib.pyplot.clim — Matplotlib 3.2.1 documentation
April 8, 2020 - matplotlib.pyplot.clim(vmin=None, vmax=None)[source]¶ · Set the color limits of the current image. If either vmin or vmax is None, the image min/max respectively will be used for color scaling.
🌐
Matplotlib
matplotlib.org › 2.1.0 › api › _as_gen › matplotlib.pyplot.clim.html
matplotlib.pyplot.clim — Matplotlib 2.1.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 Oct 13, 2017.
Find elsewhere
🌐
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.1.2 › api › _as_gen › matplotlib.pyplot.clim.html
matplotlib.pyplot.clim — Matplotlib 2.1.2 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 Feb 08, 2018.
🌐
ProgramCreek
programcreek.com › python › example › 87742 › matplotlib.pyplot.clim
Python Examples of matplotlib.pyplot.clim
""" # %% from matplotlib.pyplot import matshow, colorbar, clim, title matshow(self.direction / np.pi * 180); colorbar(); clim(0, 360) title('Direction') mag2, direction2 = self._central_slopes_directions() matshow(direction2 / np.pi * 180.0); colorbar(); clim(0, 360) title('Direction (central difference)') matshow(self.mag); colorbar() title('Magnitude') matshow(mag2); colorbar(); title("Magnitude (Central difference)") # %% # Compare to Taudem filename = self.file_name os.chdir('testtiff') try: os.remove('test_ang.tif') os.remove('test_slp.tif') except: pass cmd = ('dinfflowdir -fel "%s" -ang
🌐
Matplotlib
matplotlib.org › 3.3.3 › api › _as_gen › matplotlib.pyplot.clim.html
matplotlib.pyplot.clim — Matplotlib 3.3.3 documentation
November 12, 2020 - If you want to set the clim of multiple images, use set_clim on every image, for example:
🌐
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 › 2.2.2 › api › _as_gen › matplotlib.pyplot.clim.html
matplotlib.pyplot.clim — Matplotlib 2.2.2 documentation
June 28, 2018 - matplotlib.pyplot.clim(vmin=None, vmax=None)[source]¶ · Set the color limits of the current image. 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.
🌐
Matplotlib
matplotlib.org › 3.0.2 › api › _as_gen › matplotlib.pyplot.clim.html
matplotlib.pyplot.clim — Matplotlib 3.0.2 documentation
November 11, 2018 - matplotlib.pyplot.clim(vmin=None, vmax=None)[source]¶ · Set the color limits of the current image. 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.
🌐
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: