Colormap module

OpFlowLab.functions.colormap_functions.create_color(use_alpha=False)[source]

Generates a random color

Parameters
use_alphabool, optional

Option to set if the alpha value should be returned

Returns
colorarray_like
If use_alpha is True:

Returns a 1d array of shape (4,)

If use_alpha is False:

Returns a 1d array of shape (3,)

OpFlowLab.functions.colormap_functions.get_colors(inputs, colormap, colormap_min=None, colormap_max=None)[source]

Assigns colors to the inputs based on the provided colormap

Parameters
inputsarray_like

One dimensional array of values that will be mapped ot the color map

colormapLinearSegmentedColormap

Colormap returned from parse_colormap

colormap_minfloat, optional

Minimum value used in the scaling of the colormap

colormap_maxfloat, optional

Maximum value used in the scaling of the colormap

Returns
colorsarray_like

Colors assigned to each input based on the colormap provided

colormap_minfloat

Minimum value used in the scaling of the colormap

colormap_maxfloat

Maximum value used in the scaling of the colormap

OpFlowLab.functions.colormap_functions.list_colormaps()[source]

List the colormaps available from matplotlib

Returns
colormapsList

List of the names of the available colormaps

OpFlowLab.functions.colormap_functions.parse_colormap(colormap)[source]

Obtains colormap data from the colormap name

Parameters
colormapstr

Name of colormap

Returns
cmap: LinearSegmentedColormap
If colormap is “none” or “None”:

Returns None

Else:

Returns colormap data as LinearSegmentedColormap

OpFlowLab.functions.colormap_functions.save_colorbar(colormap, filepath=None, figsize=(6, 1), colormap_min=- 1, colormap_max=1, orientation='horizontal')[source]

Output colormap as a color bar

Parameters
colormapstr or LinearSegmentedColormap

Colormap to plot color wheel

filepathstr, optional

File path to save color wheel

figsizesequence of int of length 2, optional

Size of output figure

colormap_minfloat, optional

Minimum value used in the scaling of the colormap

colormap_maxfloat, optional

Maximum value used in the scaling of the colormap

orientationstr, optional

Determines if the color bar should be plotted in the horizontal or vertical orientation

Returns
colorbarndarray

Ndarray of the color bar image

OpFlowLab.functions.colormap_functions.save_colorwheel(colormap, filepath=None, figsize=(8, 8))[source]

Output colormap as a color wheel

Parameters
colormapstr or LinearSegmentedColormap

Colormap to plot color wheel

filepathstr, optional

File path to save color wheel

figsizesequence of int of length 2, optional

Size of output figure

Returns
colorwheelndarray

Ndarray of the color wheel image