pyissm.plot.colormaps
Custom colormaps for ISSM visualizations.
Ported from ISSM src/m/plot/colormaps/
Functions
|
Blue-Yellow-Red colormap. |
|
DEM colormap concatenating sea and land colors. |
|
Get a matplotlib colormap by name, including ISSM custom maps. |
|
IBCAO colormap for polar regions. |
|
Land colormap (green to brown). |
|
Sea colormap (deep navy to pale blue). |
|
Truncate a colormap within normalized limits [minval, maxval]. |
- pyissm.plot.colormaps.blueyellowred(n=256)
Blue-Yellow-Red colormap.
Ported from MATLAB blueyellowred.m. Runs from white through blue-purple, yellow, and into deep red.
- Parameters:
n (int) – Number of color levels. Default 256.
- Returns:
RGB color array.
- Return type:
np.ndarray, shape (3, n)
- pyissm.plot.colormaps.demmap(ncolors, minZ, maxZ, colorscheme='dem')
DEM colormap concatenating sea and land colors.
- Parameters:
ncolors (int) – Total number of colors.
minZ (float) – Minimum elevation (negative for seafloor).
maxZ (float) – Maximum elevation.
colorscheme (str) – ‘dem’ (default) or ‘ibcao’.
- Return type:
matplotlib.colors.ListedColormap
Examples
cmap = demmap(50, -300, 1200) cmap = demmap(50, -300, 1200, ‘ibcao’)
- pyissm.plot.colormaps.get_colormap(name, alpha=1)
Get a matplotlib colormap by name, including ISSM custom maps.
- Supported custom names:
‘Rignot’ — modified HSV rainbow scaled by velocity ‘demmap(n,z0,z1)’ — calls demmap(n, z0, z1) Any standard matplotlib colormap name
- Parameters:
name (str or matplotlib.colors.Colormap) – Colormap name or existing colormap object.
alpha (float) – Exponent used for ‘Rignot’ colormap. Default 1.
- Return type:
matplotlib.colors.Colormap
- pyissm.plot.colormaps.ibcao(nsea, nland)
IBCAO colormap for polar regions.
- Parameters:
nsea (int) – Number of sea colors.
nland (int) – Number of land colors.
- Returns:
RGB color array.
- Return type:
np.ndarray, shape (nsea + nland, 3)
- pyissm.plot.colormaps.landcolor(n=256)
Land colormap (green to brown).
- Parameters:
n (int) – Number of color levels. Default 256.
- Returns:
RGB color array.
- Return type:
np.ndarray, shape (3, n)
- pyissm.plot.colormaps.seacolor(n=256)
Sea colormap (deep navy to pale blue).
- Parameters:
n (int) – Number of color levels. Default 256.
- Returns:
RGB color array.
- Return type:
np.ndarray, shape (3, n)
- pyissm.plot.colormaps.truncate_colormap(cmap, minval=0.0, maxval=1.0, n=100)
Truncate a colormap within normalized limits [minval, maxval].
- Parameters:
cmap (str or matplotlib.colors.Colormap)
minval (float) – Lower bound, normalized [0, 1].
maxval (float) – Upper bound, normalized [0, 1].
n (int) – Number of levels in the new colormap.
- Return type:
matplotlib.colors.LinearSegmentedColormap
Example
cmap = truncate_colormap(‘viridis’, 0.2, 0.8)