Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitfd2884b

Browse files
committed
Remove cm.get_cmap
1 parenta30354e commitfd2884b

File tree

2 files changed

+7
-37
lines changed

2 files changed

+7
-37
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
``matplotlib.cm.get_cmap``
2+
~~~~~~~~~~~~~~~~~~~~~~~~~~
3+
4+
If you have the name of a colormap as a `str`, use ``matplotlib.colormaps[name]`` instead.
5+
6+
Otherwise `matplotlib.cm.ColormapRegistry.get_cmap` if you have a `str`, `None` or a
7+
`matplotlib.colors.Colormap` object that you want to convert to a `.Colormap` object.

‎lib/matplotlib/cm.py

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -243,43 +243,6 @@ def get_cmap(self, cmap):
243243
_bivar_colormaps=ColormapRegistry(bivar_cmaps)
244244

245245

246-
# This is an exact copy of pyplot.get_cmap(). It was removed in 3.9, but apparently
247-
# caused more user trouble than expected. Re-added for 3.9.1 and extended the
248-
# deprecation period for two additional minor releases.
249-
@_api.deprecated(
250-
'3.7',
251-
removal='3.11',
252-
alternative="``matplotlib.colormaps[name]`` or ``matplotlib.colormaps.get_cmap()``"
253-
" or ``pyplot.get_cmap()``"
254-
)
255-
defget_cmap(name=None,lut=None):
256-
"""
257-
Get a colormap instance, defaulting to rc values if *name* is None.
258-
259-
Parameters
260-
----------
261-
name : `~matplotlib.colors.Colormap` or str or None, default: None
262-
If a `.Colormap` instance, it will be returned. Otherwise, the name of
263-
a colormap known to Matplotlib, which will be resampled by *lut*. The
264-
default, None, means :rc:`image.cmap`.
265-
lut : int or None, default: None
266-
If *name* is not already a Colormap instance and *lut* is not None, the
267-
colormap will be resampled to have *lut* entries in the lookup table.
268-
269-
Returns
270-
-------
271-
Colormap
272-
"""
273-
name=mpl._val_or_rc(name,'image.cmap')
274-
ifisinstance(name,colors.Colormap):
275-
returnname
276-
_api.check_in_list(sorted(_colormaps),name=name)
277-
iflutisNone:
278-
return_colormaps[name]
279-
else:
280-
return_colormaps[name].resampled(lut)
281-
282-
283246
def_ensure_cmap(cmap):
284247
"""
285248
Ensure that we have a `.Colormap` object.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp