8000 [Bug]: `matplotlib.cm.get_cmap()` missing · Issue #28349 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content
[Bug]: matplotlib.cm.get_cmap() missing #28349
Closed
@jsolbrig

Description

@jsolbrig

Bug summary

As of matplotlib v3.9, it appears that matplotlib.cm.get_cmap() is missing. It is still available on matplotlib.pyplot.get_cmap(), though.

matplotlib.cm.get_cmap() is still shown in the documentation and I would be surprised if this change was made without some kind of deprecation warning.

Code for reproduction

In [1]: from matplotlib import pyplot, cm

In [2]: pyplot.get_cmap('gray')
Out[2]: <matplotlib.colors.LinearSegmentedColormap at 0x7f6b2c7303d0>

In [3]: cm.get_cmap('gray')
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
Cell In[3], line 1
----> 1 cm.get_cmap('gray')

AttributeError: module 'matplotlib.cm' has no attribute 'get_cmap'

Actual outcome


AttributeError Traceback (most recent call last)
Cell In[3], line 1
----> 1 cm.get_cmap('gray')

AttributeError: module 'matplotlib.cm' has no attribute 'get_cmap'

Expected outcome

Should return the gray colormap.

Additional information

This works in matplotlib <3.9 and is still shown in the documentation. It is kind of odd that this function is available from two locations, though.

Operating system

Any

Matplotlib Version

3.9.0

Matplotlib Backend

agg

Python version

3.11.9

Jupyter version

No response

Installation

pip

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0