Skip to content

[ENH]: Default matplotlib.colormaps[None] to call matplotlib.colormaps[matplotlib.rcParams['image.cmap']]? #23981

@mroeschke

Description

@mroeschke

Problem

While addressing the matplotlib.cm.get_cmap deprecation in 3.6:

PendingDeprecationWarning: The get_cmap function will be deprecated in a future version. Use ``matplotlib.colormaps[name]`` instead.

I noticed that None isn't directly migrate-able

In [1]: import matplotlib

In [2]: matplotlib.cm.get_cmap(None)
Out[2]: <matplotlib.colors.ListedColormap at 0x11e609e20>

In [3]: matplotlib.colormaps[None]
KeyError: 'None is not a known colormap name'

Proposed solution

It appears from the source that get_cmap(None) defaults to matplotlib.rcParams['image.cmap'] so it would be nice if colormaps[None] could default to that as well.

Otherwise, it would be nice if this was better documented.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy