grapa.colorscale.Colorscale
- class grapa.colorscale.Colorscale(colors=None, space='rgb', invert=False)
Bases:
objectThis class handles the color scales. Input ‘colors’ can be:
a matplotlib color str e.g. viridis
a list of colors. The colorscale will interpolate between these colors. The colors are assumed to be uniformly spaced on te value axis. If the last element of the color list is a string, it is interpreted as the colorspace e.g. rgb, hls, hsv. The color gradient is calculated in this colorspace
- __init__(colors=None, space='rgb', invert=False)
Colors a list of colors in the format [[1,0,0], [1,1,0.5], [0,1,0]]
Methods
__init__([colors, space, invert])Colors a list of colors in the format [[1,0,0], [1,1,0.5], [0,1,0]]
cmap([nbins, avoid_white])Returns a matplotlib LinearSegmentedColormap object
Get the colorscale
Inverse the Colorscale
values_to_color(values[, space_out, avoid_white])Return the color corresponding to a value.
- cmap(nbins=256, avoid_white=False)
Returns a matplotlib LinearSegmentedColormap object
- get_colorscale()
Get the colorscale
- inverse_scale()
Inverse the Colorscale
- values_to_color(values, space_out='rgb', avoid_white=True)
Return the color corresponding to a value. values is a value np.array([value0, value1, value3, etc.]), with valuesN being between 0 and 1