Skip to content

Commit bbcffa8

Browse files
committed
Fix recently introduced bug where fail to convert twilight_shifted
1 parent 23d4cc9 commit bbcffa8

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

proplot/colors.py

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,6 @@
2222
from .internals import _not_none, docstring, warnings
2323
from .utils import to_rgb, to_rgba, to_xyz, to_xyza
2424

25-
if hasattr(mcm, '_cmap_registry'):
26-
_cmap_database_attr = '_cmap_registry'
27-
else:
28-
_cmap_database_attr = 'cmap_d'
29-
_cmap_database = getattr(mcm, _cmap_database_attr)
30-
31-
3225
__all__ = [
3326
'ListedColormap',
3427
'LinearSegmentedColormap',
@@ -2564,12 +2557,16 @@ def _sanitize_key(self, key, mirror=True):
25642557
mcolors.colorConverter.colors = _map
25652558

25662559
# Replace colormap database with custom database
2560+
# WARNING: Skip over the matplotlib native duplicate entries with
2561+
# suffixes '_r' and '_shifted'.
2562+
_cmap_database_attr = '_cmap_registry' if hasattr(mcm, '_cmap_registry') else 'cmap_d'
2563+
_cmap_database = getattr(mcm, _cmap_database_attr)
25672564
if mcm.get_cmap is not _get_cmap:
25682565
mcm.get_cmap = _get_cmap
25692566
if not isinstance(_cmap_database, ColormapDatabase):
25702567
_cmap_database = {
25712568
key: value for key, value in _cmap_database.items()
2572-
if key[-2:] != '_r' and key[-2:] != '_s'
2569+
if key[-2:] != '_r' and key[-8:] != '_shifted'
25732570
}
25742571
_cmap_database = ColormapDatabase(_cmap_database)
25752572
setattr(mcm, _cmap_database_attr, _cmap_database)

0 commit comments

Comments
 (0)