Closed
Description
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.