Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit a987e31

Browse files
committed
API: accept that pyplot.get_cmap is not going away
Add it to the rendered docs.
1 parent 08ac800 commit a987e31

File tree

3 files changed

+5
-2
lines changed

3 files changed

+5
-2
lines changed

doc/api/next_api_changes/deprecations/23668-TC.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ following functions have been marked for pending deprecation:
1919
- `matplotlib.cm.unregister_cmap` - use ``matplotlib.colormaps.unregister`` instead
2020
- ``matplotlib.pyplot.register_cmap`` - use ``matplotlib.colormaps.register`` instead
2121

22-
The ``matplotlib.pyplot.get_cmap`` function will stay available for backward compatibility.
22+
The `matplotlib.pyplot.get_cmap` function will stay available for backward compatibility.

doc/api/pyplot_summary.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ Plotting commands
6464
gcf
6565
gci
6666
get
67+
get_cmap
6768
get_figlabels
6869
get_fignums
6970
getp

lib/matplotlib/pyplot.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2022,7 +2022,7 @@ def get_plot_commands():
20222022
# This works by searching for all functions in this module and removing
20232023
# a few hard-coded exclusions, as well as all of the colormap-setting
20242024
# functions, and anything marked as private with a preceding underscore.
2025-
exclude = {'colormaps', 'colors', 'get_plot_commands', 'get_cmap',
2025+
exclude = {'colormaps', 'colors', 'get_plot_commands',
20262026
*_NON_PLOT_COMMANDS, *colormaps}
20272027
this_module = inspect.getmodule(get_plot_commands)
20282028
return sorted(
@@ -2069,6 +2069,8 @@ def clim(vmin=None, vmax=None):
20692069
im.set_clim(vmin, vmax)
20702070

20712071

2072+
# eventually this implementation should move here, use indirection for now to
2073+
# avoid having two copies of the code floating around.
20722074
def get_cmap(name=None, lut=None):
20732075
return cm._get_cmap(name=name, lut=lut)
20742076
get_cmap.__doc__ = cm._get_cmap.__doc__

0 commit comments

Comments
 (0)