visbrain.utils.Colormap

class visbrain.utils.Colormap(cmap='viridis', clim=None, vmin=None, under=None, vmax=None, over=None, translucent=None, alpha=1.0, lut_len=1024, interpolation=None)[source][source]

Main colormap class.

Parameters:
cmap : string | inferno

Matplotlib colormap

clim : tuple/list | None

Limit of the colormap. The clim parameter must be a tuple / list of two float number each one describing respectively the (min, max) of the colormap. Every values under clim[0] or over clim[1] will peaked.

alpha : float | 1.0

The opacity to use. The alpha parameter must be between 0 and 1.

vmin : float | None

Threshold from which every color will have the color defined using the under parameter bellow.

under : tuple/string | ‘dimgray’

Matplotlib color for values under vmin.

vmax : float | None

Threshold from which every color will have the color defined using the over parameter bellow.

over : tuple/string | ‘darkred’

Matplotlib color for values over vmax.

translucent : tuple | None

Set a specific range translucent. With f_1 and f_2 two floats, if translucent is :

  • (f_1, f_2) : values between f_1 and f_2 are set to translucent
  • (None, f_2) x <= f_2 are set to translucent
  • (f_1, None) f_1 <= x are set to translucent
lut_len : int | 1024

Number of levels for the colormap.

interpolation : {None, ‘linear’, ‘cubic’}

Interpolation type. Default is None.

Attributes:
data : array_like

Get colormap data.

shape : tuple

Get the shape of the data.

r : array_like

Get red levels.

g : array_like

Get green levels.

b : array_like

Get blue levels.

rgb : array_like

Get rgb levels.

alpha : array_like

Get transparency level.

glsl : vispy.colors.Colormap

Get a glsl version of the colormap.

__init__(cmap='viridis', clim=None, vmin=None, under=None, vmax=None, over=None, translucent=None, alpha=1.0, lut_len=1024, interpolation=None)[source][source]

Init.

Methods

__init__([cmap, clim, vmin, under, vmax, …]) Init.
to_rgba(data) Turn a data vector into colors using colormap properties.

Attributes

alpha Get transparency level.
b Get blue levels.
data Get colormap data.
g Get green levels.
glsl Get a glsl version of the colormap.
r Get red levels.
rgb Get rgb levels.
shape Get the shape of the data.
alpha

Get transparency level.

b

Get blue levels.

data

Get colormap data.

g

Get green levels.

glsl

Get a glsl version of the colormap.

r

Get red levels.

rgb

Get rgb levels.

shape

Get the shape of the data.

to_rgba(data)[source][source]

Turn a data vector into colors using colormap properties.

Parameters:
data : array_like

Vector of data of shape (n_data,).

Returns:
color : array_like

Array of colors of shape (n_data, 4)