You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The new colormaps (viridis, magma, plasma, and inferno) do not appear in the plt.cm.datad dictionary.
C:\>python
Python 3.5.0 (v3.5.0:374f501f4567, Sep 13 2015, 02:27:37) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import matplotlib as mpl
>>> import matplotlib.pyplot as plt
>>> print(mpl.__version__)
1.5.0rc2
>>> 'jet' in plt.cm.datad
True
>>> 'viridis' in plt.cm.datad
False
>>> s1 = set(plt.colormaps())
>>> s2 = set(plt.cm.datad.keys())
>>> sorted(s1 - s2)
['inferno', 'inferno_r', 'magma', 'magma_r', 'plasma', 'plasma_r', 'viridis', 'viridis_r']
>>> mpl.cm.datad is plt.cm.datad
True
>>>
As a result, the pylab_examples example code demo_bboximage.py will not include the new color maps, and the documentation for matplotlib.cm.get_cmap(name=None, Lut=None) is no longer correct. It states that "name must be a standard mpl colormap name with a corresponding data dictionary in datad." In fact, map = mpl.cm.get_cmap('viridis') works just fine despite the fact that 'viridis' has no entry in datad.
Suggested fix:
Add the new colormaps to plt.cm.datad.
Alternate fix:
Update demo_bboximage.py to include the new colormaps.
Update the documentation for matplotlib.cm.get_cmap().
The text was updated successfully, but these errors were encountered:
Good catch.
Your alternate fix is the way to go. These maps are implemented using a more compact format than would be the case if they were in datad; the same could be done with many of the existing mpl colormaps.
The new colormaps (viridis, magma, plasma, and inferno) do not appear in the plt.cm.datad dictionary.
As a result, the pylab_examples example code
demo_bboximage.py
will not include the new color maps, and the documentation formatplotlib.cm.get_cmap(name=None, Lut=None)
is no longer correct. It states that "name must be a standard mpl colormap name with a corresponding data dictionary in datad." In fact,map = mpl.cm.get_cmap('viridis')
works just fine despite the fact that 'viridis' has no entry in datad.Suggested fix:
Alternate fix:
demo_bboximage.py
to include the new colormaps.matplotlib.cm.get_cmap()
.The text was updated successfully, but these errors were encountered: