s3dlib.cmap_xtra Functions

These functions use the colorspacious package.

Auxiliary functions for use with Matplotlib.

s3dlib.cmap_xtra.Cmap_Lab_gradient(cmap, lowL=None, hiL=None, name=None)[source]

A linear-in-Lab-space Colormap with a hue matched to cmap at maximum saturation.

Parameters:
  • cmap (colormap) –
  • lowL (number, optional, default: cmap min L* @ boundaries) – The minimum L* lightness value in range 0 to <1
  • hiL (number, optional, default: cmap max L* @ boundaries) – The maximum L* lightness value in range >0 to 1.
  • name (str, optional, default: None) – The registered name to identify the colormap. If None, ‘_L’ will be appended to the colormap name.
Returns:

ListedColormap – An instance of a colormap.

s3dlib.cmap_xtra.Hue_Lab_gradient(color, lowL=0.0, hiL=1.0, name=None)[source]

A linear-in-Lab-space Colormap with a constant hue, with option of registering the map.

Parameters:
  • color (RGB color(str,list,tuple) or number in the domain[0,1]) – Vaule is used to
  • lowL (number, optional, default: 0.0) – The minimum L* lightness value in range 0 to <1
  • hiL (number, optional, default: 1.0) – The maximum L* lightness value in range >0 to 1.
  • name (str, optional, default: None) – The registered name to identify the colormap. If it’s None and color is a string, name is assigned to the string_L. Otherwize, if it’s None, name is assigned a string of 8 random characters.
Returns:

ListedColormap – An instance of a colormap.

s3dlib.cmap_xtra.Lab_cmap_gradient(lowColor='k', highColor='w', name=None, mirrored=False)[source]

A linear-in-Lab-space Colormap, with option of registering the map.

Parameters:
  • lowColor (RGB color, optional, default: 'black') – Color at the low end of the Colormap range.
  • highColor (RGB color, optional, default: 'white') – Color at the high end of the Colormap range.
  • name (str, optional) – The registered name to identify the colormap. If it’s None, the name will be a string of 8 random characters.
  • mirrored (bool) – If True, colormap is divided into two linear segments with the lowColor at the low and high values, the highColor in the middle.
Returns:

ListedColormap – An instance of a colormap.

s3dlib.cmap_xtra.show_cmaps(plt, cmaps, onlyColormaps=True, show=True)[source]

Construct and show Matplotlib figures of colormaps.

Parameters:
  • plt (matplotlib.pyplot) –
  • cmaps (List of colormaps.) – List contains colormaps or strings of registered colormap names.
  • onlyColormaps (bool {True,False}, optional, default: True) – If True, only a color scale figure is shown. If False, the L* gray scale and L* line plot figures are also shown.
  • show (bool {True,False}, optional, default: True) – If True, the plt method ‘show()’ will be executed.