This notebook illustrates the colormap API provided by VisPy.
In [ ]:
import numpy as np
from vispy.color import (get_colormap, get_colormaps, Colormap)
from IPython.display import display_html
In [ ]:
for cmap in get_colormaps():
display_html('<h3>%s</h3>' % cmap, raw=True)
display_html(get_colormap(cmap))
Discrete colormaps can be created by giving a list of colors, and an optional list of control points (in $[0,1]$, the first and last points need to be $0$ and $1$ respectively). The colors can be specified in many ways (1-character shortcuts, hexadecimal values, arrays or RGB values, ColorArray instances, and so on).
In [ ]:
Colormap(['r', 'g', 'b'], interpolation='zero')
In [ ]:
Colormap(['r', 'g', 'y'], interpolation='zero')
In [ ]:
Colormap(np.array([[0, .75, 0],
[.75, .25, .5]]),
[0., .25, 1.],
interpolation='zero')
In [ ]:
Colormap(['r', 'g', '#123456'],
interpolation='zero')
In [ ]:
Colormap(['r', 'g', '#123456'])
In [ ]:
Colormap([[1,0,0], [1,1,1], [1,0,1]],
[0., .75, 1.])