Skip to content
Prev Previous commit
Next Next commit
Fix issue where we overwrite mcm.get_cmap with useless docstring
  • Loading branch information
lukelbd committed Jul 9, 2021
commit d083438c718404c3afd9be0c349c8216fa4c68c1
16 changes: 14 additions & 2 deletions proplot/colors.py
Original file line number Diff line number Diff line change
Expand Up @@ -2366,9 +2366,21 @@ def __getitem__(self, key):

def _get_cmap(name=None, lut=None):
"""
Monkey patch for matplotlib `~matplotlib.get_cmap`. Permits case-insensitive
search of monkey-patched colormap database (which was broken in v3.2.0).
Return the registered colormap instance.

Parameters
----------
name : `matplotlib.colors.Colormap` or str or None, optional
If a `~matplotlib.colors.Colormap` instance, it will be returned. Otherwise,
the name of the registered colormap will be looked up and resampled by `lut`.
If ``None``, the default colormap :rc:`image.cmap` is returned.
lut : int or None, optional
If `name` is not already a `~matplotlib.colors.Colormap` instance
and `lut` is not None, the colormap will be resampled to have `lut`
entries in the lookup table.
"""
# Monkey patch for matplotlib `~matplotlib.get_cmap`. Permits case-insensitive
# search of monkey-patched colormap database (which was broken in v3.2.0).
if name is None:
name = rcParams['image.cmap']
if isinstance(name, mcolors.Colormap):
Expand Down