Skip to content

Commit

Permalink
ENH: future proof against matplotlib's evolving API
Browse files Browse the repository at this point in the history
  • Loading branch information
neutrinoceros committed Sep 6, 2022
1 parent 1e76ef9 commit e4f99b1
Show file tree
Hide file tree
Showing 57 changed files with 103 additions and 80 deletions.
4 changes: 2 additions & 2 deletions cmasher/cli_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@

# Package imports
import e13tools as e13
from matplotlib import cm as mplcm
import numpy as np

# CMasher imports
from cmasher import __version__
from cmasher.utils import _get_cmap
import cmasher as cmr

# All declaration
Expand Down Expand Up @@ -180,7 +180,7 @@ def cli_lang_usage_r():
def get_cmap(cmap):
# Try to obtain the colormap from MPL
try:
cmap = mplcm.get_cmap(cmap)
cmap = _get_cmap(cmap)

# If this does not work, try to expand given cmap in setuptools-style
except ValueError:
Expand Down
2 changes: 1 addition & 1 deletion cmasher/colormaps/amber/amber.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# %% IMPORTS
# Package imports
from matplotlib.cm import register_cmap
from cmasher.utils import _register_cmap as register_cmap
from matplotlib.colors import ListedColormap

# All declaration
Expand Down
2 changes: 1 addition & 1 deletion cmasher/colormaps/amethyst/amethyst.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# %% IMPORTS
# Package imports
from matplotlib.cm import register_cmap
from cmasher.utils import _register_cmap as register_cmap
from matplotlib.colors import ListedColormap

# All declaration
Expand Down
2 changes: 1 addition & 1 deletion cmasher/colormaps/apple/apple.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# %% IMPORTS
# Package imports
from matplotlib.cm import register_cmap
from cmasher.utils import _register_cmap as register_cmap
from matplotlib.colors import ListedColormap

# All declaration
Expand Down
2 changes: 1 addition & 1 deletion cmasher/colormaps/arctic/arctic.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# %% IMPORTS
# Package imports
from matplotlib.cm import register_cmap
from cmasher.utils import _register_cmap as register_cmap
from matplotlib.colors import ListedColormap

# All declaration
Expand Down
2 changes: 1 addition & 1 deletion cmasher/colormaps/bubblegum/bubblegum.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# %% IMPORTS
# Package imports
from matplotlib.cm import register_cmap
from cmasher.utils import _register_cmap as register_cmap
from matplotlib.colors import ListedColormap

# All declaration
Expand Down
2 changes: 1 addition & 1 deletion cmasher/colormaps/chroma/chroma.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# %% IMPORTS
# Package imports
from matplotlib.cm import register_cmap
from cmasher.utils import _register_cmap as register_cmap
from matplotlib.colors import ListedColormap

# All declaration
Expand Down
2 changes: 1 addition & 1 deletion cmasher/colormaps/copper/copper.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# %% IMPORTS
# Package imports
from matplotlib.cm import register_cmap
from cmasher.utils import _register_cmap as register_cmap
from matplotlib.colors import ListedColormap

# All declaration
Expand Down
2 changes: 1 addition & 1 deletion cmasher/colormaps/cosmic/cosmic.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# %% IMPORTS
# Package imports
from matplotlib.cm import register_cmap
from cmasher.utils import _register_cmap as register_cmap
from matplotlib.colors import ListedColormap

# All declaration
Expand Down
2 changes: 1 addition & 1 deletion cmasher/colormaps/dusk/dusk.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# %% IMPORTS
# Package imports
from matplotlib.cm import register_cmap
from cmasher.utils import _register_cmap as register_cmap
from matplotlib.colors import ListedColormap

# All declaration
Expand Down
2 changes: 1 addition & 1 deletion cmasher/colormaps/eclipse/eclipse.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# %% IMPORTS
# Package imports
from matplotlib.cm import register_cmap
from cmasher.utils import _register_cmap as register_cmap
from matplotlib.colors import ListedColormap

# All declaration
Expand Down
2 changes: 1 addition & 1 deletion cmasher/colormaps/ember/ember.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# %% IMPORTS
# Package imports
from matplotlib.cm import register_cmap
from cmasher.utils import _register_cmap as register_cmap
from matplotlib.colors import ListedColormap

# All declaration
Expand Down
2 changes: 1 addition & 1 deletion cmasher/colormaps/emerald/emerald.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# %% IMPORTS
# Package imports
from matplotlib.cm import register_cmap
from cmasher.utils import _register_cmap as register_cmap
from matplotlib.colors import ListedColormap

# All declaration
Expand Down
2 changes: 1 addition & 1 deletion cmasher/colormaps/emergency/emergency.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# %% IMPORTS
# Package imports
from matplotlib.cm import register_cmap
from cmasher.utils import _register_cmap as register_cmap
from matplotlib.colors import ListedColormap

# All declaration
Expand Down
2 changes: 1 addition & 1 deletion cmasher/colormaps/fall/fall.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# %% IMPORTS
# Package imports
from matplotlib.cm import register_cmap
from cmasher.utils import _register_cmap as register_cmap
from matplotlib.colors import ListedColormap

# All declaration
Expand Down
2 changes: 1 addition & 1 deletion cmasher/colormaps/flamingo/flamingo.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# %% IMPORTS
# Package imports
from matplotlib.cm import register_cmap
from cmasher.utils import _register_cmap as register_cmap
from matplotlib.colors import ListedColormap

# All declaration
Expand Down
2 changes: 1 addition & 1 deletion cmasher/colormaps/freeze/freeze.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# %% IMPORTS
# Package imports
from matplotlib.cm import register_cmap
from cmasher.utils import _register_cmap as register_cmap
from matplotlib.colors import ListedColormap

# All declaration
Expand Down
2 changes: 1 addition & 1 deletion cmasher/colormaps/fusion/fusion.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# %% IMPORTS
# Package imports
from matplotlib.cm import register_cmap
from cmasher.utils import _register_cmap as register_cmap
from matplotlib.colors import ListedColormap

# All declaration
Expand Down
2 changes: 1 addition & 1 deletion cmasher/colormaps/gem/gem.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# %% IMPORTS
# Package imports
from matplotlib.cm import register_cmap
from cmasher.utils import _register_cmap as register_cmap
from matplotlib.colors import ListedColormap

# All declaration
Expand Down
2 changes: 1 addition & 1 deletion cmasher/colormaps/ghostlight/ghostlight.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# %% IMPORTS
# Package imports
from matplotlib.cm import register_cmap
from cmasher.utils import _register_cmap as register_cmap
from matplotlib.colors import ListedColormap

# All declaration
Expand Down
2 changes: 1 addition & 1 deletion cmasher/colormaps/gothic/gothic.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# %% IMPORTS
# Package imports
from matplotlib.cm import register_cmap
from cmasher.utils import _register_cmap as register_cmap
from matplotlib.colors import ListedColormap

# All declaration
Expand Down
2 changes: 1 addition & 1 deletion cmasher/colormaps/guppy/guppy.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# %% IMPORTS
# Package imports
from matplotlib.cm import register_cmap
from cmasher.utils import _register_cmap as register_cmap
from matplotlib.colors import ListedColormap

# All declaration
Expand Down
2 changes: 1 addition & 1 deletion cmasher/colormaps/holly/holly.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# %% IMPORTS
# Package imports
from matplotlib.cm import register_cmap
from cmasher.utils import _register_cmap as register_cmap
from matplotlib.colors import ListedColormap

# All declaration
Expand Down
2 changes: 1 addition & 1 deletion cmasher/colormaps/horizon/horizon.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# %% IMPORTS
# Package imports
from matplotlib.cm import register_cmap
from cmasher.utils import _register_cmap as register_cmap
from matplotlib.colors import ListedColormap

# All declaration
Expand Down
2 changes: 1 addition & 1 deletion cmasher/colormaps/iceburn/iceburn.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# %% IMPORTS
# Package imports
from matplotlib.cm import register_cmap
from cmasher.utils import _register_cmap as register_cmap
from matplotlib.colors import ListedColormap

# All declaration
Expand Down
2 changes: 1 addition & 1 deletion cmasher/colormaps/infinity/infinity.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# %% IMPORTS
# Package imports
from matplotlib.cm import register_cmap
from cmasher.utils import _register_cmap as register_cmap
from matplotlib.colors import ListedColormap

# All declaration
Expand Down
2 changes: 1 addition & 1 deletion cmasher/colormaps/jungle/jungle.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# %% IMPORTS
# Package imports
from matplotlib.cm import register_cmap
from cmasher.utils import _register_cmap as register_cmap
from matplotlib.colors import ListedColormap

# All declaration
Expand Down
2 changes: 1 addition & 1 deletion cmasher/colormaps/lavender/lavender.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# %% IMPORTS
# Package imports
from matplotlib.cm import register_cmap
from cmasher.utils import _register_cmap as register_cmap
from matplotlib.colors import ListedColormap

# All declaration
Expand Down
2 changes: 1 addition & 1 deletion cmasher/colormaps/lilac/lilac.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# %% IMPORTS
# Package imports
from matplotlib.cm import register_cmap
from cmasher.utils import _register_cmap as register_cmap
from matplotlib.colors import ListedColormap

# All declaration
Expand Down
2 changes: 1 addition & 1 deletion cmasher/colormaps/neon/neon.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# %% IMPORTS
# Package imports
from matplotlib.cm import register_cmap
from cmasher.utils import _register_cmap as register_cmap
from matplotlib.colors import ListedColormap

# All declaration
Expand Down
2 changes: 1 addition & 1 deletion cmasher/colormaps/neutral/neutral.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# %% IMPORTS
# Package imports
from matplotlib.cm import register_cmap
from cmasher.utils import _register_cmap as register_cmap
from matplotlib.colors import ListedColormap

# All declaration
Expand Down
2 changes: 1 addition & 1 deletion cmasher/colormaps/nuclear/nuclear.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# %% IMPORTS
# Package imports
from matplotlib.cm import register_cmap
from cmasher.utils import _register_cmap as register_cmap
from matplotlib.colors import ListedColormap

# All declaration
Expand Down
2 changes: 1 addition & 1 deletion cmasher/colormaps/ocean/ocean.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# %% IMPORTS
# Package imports
from matplotlib.cm import register_cmap
from cmasher.utils import _register_cmap as register_cmap
from matplotlib.colors import ListedColormap

# All declaration
Expand Down
2 changes: 1 addition & 1 deletion cmasher/colormaps/pepper/pepper.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# %% IMPORTS
# Package imports
from matplotlib.cm import register_cmap
from cmasher.utils import _register_cmap as register_cmap
from matplotlib.colors import ListedColormap

# All declaration
Expand Down
2 changes: 1 addition & 1 deletion cmasher/colormaps/pride/pride.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# %% IMPORTS
# Package imports
from matplotlib.cm import register_cmap
from cmasher.utils import _register_cmap as register_cmap
from matplotlib.colors import ListedColormap

# All declaration
Expand Down
2 changes: 1 addition & 1 deletion cmasher/colormaps/prinsenvlag/prinsenvlag.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# %% IMPORTS
# Package imports
from matplotlib.cm import register_cmap
from cmasher.utils import _register_cmap as register_cmap
from matplotlib.colors import ListedColormap

# All declaration
Expand Down
2 changes: 1 addition & 1 deletion cmasher/colormaps/rainforest/rainforest.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# %% IMPORTS
# Package imports
from matplotlib.cm import register_cmap
from cmasher.utils import _register_cmap as register_cmap
from matplotlib.colors import ListedColormap

# All declaration
Expand Down
2 changes: 1 addition & 1 deletion cmasher/colormaps/redshift/redshift.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# %% IMPORTS
# Package imports
from matplotlib.cm import register_cmap
from cmasher.utils import _register_cmap as register_cmap
from matplotlib.colors import ListedColormap

# All declaration
Expand Down
2 changes: 1 addition & 1 deletion cmasher/colormaps/sapphire/sapphire.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# %% IMPORTS
# Package imports
from matplotlib.cm import register_cmap
from cmasher.utils import _register_cmap as register_cmap
from matplotlib.colors import ListedColormap

# All declaration
Expand Down
2 changes: 1 addition & 1 deletion cmasher/colormaps/savanna/savanna.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# %% IMPORTS
# Package imports
from matplotlib.cm import register_cmap
from cmasher.utils import _register_cmap as register_cmap
from matplotlib.colors import ListedColormap

# All declaration
Expand Down
2 changes: 1 addition & 1 deletion cmasher/colormaps/seasons/seasons.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# %% IMPORTS
# Package imports
from matplotlib.cm import register_cmap
from cmasher.utils import _register_cmap as register_cmap
from matplotlib.colors import ListedColormap

# All declaration
Expand Down
2 changes: 1 addition & 1 deletion cmasher/colormaps/seaweed/seaweed.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# %% IMPORTS
# Package imports
from matplotlib.cm import register_cmap
from cmasher.utils import _register_cmap as register_cmap
from matplotlib.colors import ListedColormap

# All declaration
Expand Down
2 changes: 1 addition & 1 deletion cmasher/colormaps/sepia/sepia.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# %% IMPORTS
# Package imports
from matplotlib.cm import register_cmap
from cmasher.utils import _register_cmap as register_cmap
from matplotlib.colors import ListedColormap

# All declaration
Expand Down
2 changes: 1 addition & 1 deletion cmasher/colormaps/sunburst/sunburst.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# %% IMPORTS
# Package imports
from matplotlib.cm import register_cmap
from cmasher.utils import _register_cmap as register_cmap
from matplotlib.colors import ListedColormap

# All declaration
Expand Down
2 changes: 1 addition & 1 deletion cmasher/colormaps/swamp/swamp.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# %% IMPORTS
# Package imports
from matplotlib.cm import register_cmap
from cmasher.utils import _register_cmap as register_cmap
from matplotlib.colors import ListedColormap

# All declaration
Expand Down
2 changes: 1 addition & 1 deletion cmasher/colormaps/torch/torch.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# %% IMPORTS
# Package imports
from matplotlib.cm import register_cmap
from cmasher.utils import _register_cmap as register_cmap
from matplotlib.colors import ListedColormap

# All declaration
Expand Down
2 changes: 1 addition & 1 deletion cmasher/colormaps/toxic/toxic.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# %% IMPORTS
# Package imports
from matplotlib.cm import register_cmap
from cmasher.utils import _register_cmap as register_cmap
from matplotlib.colors import ListedColormap

# All declaration
Expand Down
2 changes: 1 addition & 1 deletion cmasher/colormaps/tree/tree.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# %% IMPORTS
# Package imports
from matplotlib.cm import register_cmap
from cmasher.utils import _register_cmap as register_cmap
from matplotlib.colors import ListedColormap

# All declaration
Expand Down
Loading

0 comments on commit e4f99b1

Please sign in to comment.