vispy.color.colormap.
BaseColormap
Bases: object
object
Class representing a colormap:
t in [0, 1] –> rgba_color
The control colors used by the colormap (shape = (ncolors, 4)).
Notes
Must be overriden. Child classes need to implement:
The GLSL function for the colormap. Use $color_0 to refer to the first color in colors, and so on. These are vec4 vectors.
Takes a (N, 1) vector of values in [0, 1], and returns a rgba array of size (N, 4).
colors
glsl_map
map
Return a rgba array for the requested items.
This function must be overriden by child classes.
This function doesn’t need to implement argument checking on item. It can always assume that item is a (N, 1) array of values between 0 and 1.
An array of values in [0,1].
An array with rgba values, with one color per item. The shape should be item.shape + (4,).
item.shape + (4,)
Users are expected to use a colormap with __getitem__() rather than map() (which implements a lower-level API).
__getitem__()
map()
texture_map_data
Colormap
Bases: vispy.color.colormap.BaseColormap
vispy.color.colormap.BaseColormap
A colormap defining several control colors and an interpolation scheme.
The list of control colors. If not a ColorArray, a new ColorArray instance is created from this list. See the documentation of ColorArray.
ColorArray
The list of control points for the given colors. It should be an increasing list of floating-point number between 0.0 and 1.0. The first control point must be 0.0. The last control point must be 1.0. The number of control points depends on the interpolation scheme.
The interpolation mode of the colormap. Default: ‘linear’. Can also be ‘zero’. If ‘linear’, ncontrols = ncolors (one color per control point). If ‘zero’, ncontrols = ncolors+1 (one color per bin).
Examples
Here is a basic example:
>>> from vispy.color import Colormap >>> cm = Colormap(['r', 'g', 'b']) >>> cm[0.], cm[0.5], cm[np.linspace(0., 1., 100)]
interpolation
The interpolation mode of the colormap
The Python mapping function from the [0,1] interval to a list of rgba colors
The values to map.
List of rgba colors.
texture_lut
Return a texture2D object for LUT after its value is set.
CubeHelixColormap
Bases: vispy.color.colormap.Colormap
vispy.color.colormap.Colormap
MatplotlibColormap
Use matplotlib colormaps if installed.
Name of the colormap.
get_colormap
Obtain a colormap
Some colormaps can have additional configuration parameters. Refer to their corresponding documentation for more information.
Colormap name. Can also be a Colormap for pass-through.
>>> get_colormap('autumn') >>> get_colormap('single_hue', hue=10)
get_colormaps
Return the list of colormap names.
mix
smoothstep
performs smooth Hermite interpolation between 0 and 1 when edge0 < x < edge1.
step