-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
MAINT deprecated 'spectral' in favor of 'nipy_spectral' #7416
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
c708871
066cfe0
6d7aaee
c5738e2
5de2f95
954bf7a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,17 +10,17 @@ | |
import six | ||
|
||
import os | ||
|
||
import warnings as _warnings # To remove once spectral is removed | ||
import numpy as np | ||
from numpy import ma | ||
import matplotlib as mpl | ||
import matplotlib.colors as colors | ||
import matplotlib.cbook as cbook | ||
from matplotlib._cm import datad | ||
from matplotlib._cm import datad, _deprecation_datad | ||
from matplotlib._cm import cubehelix | ||
from matplotlib._cm_listed import cmaps as cmaps_listed | ||
|
||
cmap_d = dict() | ||
cmap_d = _deprecation_datad() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Note that line 88 of this file will likely trigger the deprecation warning if I'm not wrong, as it loop through all the colormap to build the reversed ones. Not sure what we can do about the though. Just pointing it out. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. argh… you are right. |
||
|
||
# reverse all the colormaps. | ||
# reversed colormaps have '_r' appended to the name. | ||
|
@@ -81,17 +81,22 @@ def _generate_cmap(name, lutsize): | |
|
||
LUTSIZE = mpl.rcParams['image.lut'] | ||
|
||
# Generate the reversed specifications ... | ||
for cmapname in list(six.iterkeys(datad)): | ||
spec = datad[cmapname] | ||
spec_reversed = _reverse_cmap_spec(spec) | ||
datad[cmapname + '_r'] = spec_reversed | ||
|
||
# Precache the cmaps with ``lutsize = LUTSIZE`` ... | ||
|
||
# Use datad.keys() to also add the reversed ones added in the section above: | ||
for cmapname in six.iterkeys(datad): | ||
cmap_d[cmapname] = _generate_cmap(cmapname, LUTSIZE) | ||
# We silence warnings here to avoid raising the deprecation warning for | ||
# spectral/spectral_r when this module is imported. | ||
with _warnings.catch_warnings(): | ||
_warnings.simplefilter("ignore") | ||
# Generate the reversed specifications ... | ||
for cmapname in list(six.iterkeys(datad)): | ||
spec = datad[cmapname] | ||
spec_reversed = _reverse_cmap_spec(spec) | ||
datad[cmapname + '_r'] = spec_reversed | ||
|
||
# Precache the cmaps with ``lutsize = LUTSIZE`` ... | ||
|
||
# Use datad.keys() to also add the reversed ones added in the section | ||
# above: | ||
for cmapname in six.iterkeys(datad): | ||
cmap_d[cmapname] = _generate_cmap(cmapname, LUTSIZE) | ||
|
||
cmap_d.update(cmaps_listed) | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do you want to make the message dynamic for
spectral_r
as well ? I can see pros and cons to both.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was going to be lazy, and not do it, but… maybe I should.