scicm.tools - MBravoS/scicm GitHub Wiki
scicm.tools.crop(cmapin,vmin=0.0,vmax=1.0,name_newcmap=None) [source]
Crop colour map between vmin/vmax values. Can also register the new colour map with matplotlib.
Call signature:
scicm.tools.crop(cmapin,**kwargs)
cmapin: str or object
A string with the name of the colour map or the colour map object.
vmin/vmax: float, optional
If given, the normalised low/high limits to select from the source colour map. Values must be in the [0,1] range and vmin<vmax
. Defaults to vmin=0
and vmax=1
(i.e., returns the input colour map).
name_newcmap: str, optional
If given, defines the name to register with matplotlib.
matplotlib.colors.LinearSegmentedColormap
Colour map object with the new colour map.
scicm.tools.stitch(cmapinlist,vlims,tpoints,name_newcmap='newcmap') [source]
Crop colour map between vmin/vmax values. Can also register the new colour map with matplotlib.
Call signature:
scicm.tools.stitch(cmapinlist,vlims,tpoints,**kwargs)
cmapinlist: list
Each element must be either a string with the name of each colour map or the colour map objects.
vlims: numpy.ndarray
A (N,2) array that contains the vmin and vmax values used for cropping the colour maps and setting the ranges that each crop will take on the new colou rmap. vlims[:,0] are the low limits (vmin) and vlims[:,1] the high limits (vmax).
tpoints: list, tuple or numpy.ndarray
Contains the transition points where the new colour map will transition from one input colour map to the next.
name_newcmap: str, optional
If given, defines the name to register with matplotlib.
matplotlib.colors.LinearSegmentedColormap
Colour map object with the new colour map.
scicm.tools.merge(cmapinlist,tpoints,name_newcmap='newcmap') [source]
Merge together the selected crops from the given list of colour maps. Can also register the new colour map with matplotlib. This is a light wrapper around scicm.tools.stitch, which uses the transition points as the vmin/vmax values to crop each input colour map.
Call signature:
scicm.tools.merge(cmapinlist,tpoints,**kwargs)
cmapinlist: list
Each element must be either a string with the name of each colour map or the colour map objects.
tpoints: list, tuple or numpy.ndarray
 Contains the transition points where the new colour map will transition from one input colour map to the next.
name_newcmap: str, optional
If given, defines the name to register with matplotlib.
matplotlib.colors.LinearSegmentedColormap
Colour map object with the new colour map.