yt.visualization.volume_rendering.transfer_functions.ColorTransferFunction.sample_colormap

ColorTransferFunction.sample_colormap(v, w, alpha=None, colormap='gist_stern', col_bounds=None)[source]

Add a Gaussian based on an existing colormap.

Constructing pleasing Gaussians in a transfer function can pose some challenges, so this function will add a single Gaussian whose colors are taken from a colormap scaled between the bounds of the transfer function. As with TransferFunction.add_gaussian, the value is calculated as f(x) = h \exp{-(x-x_0)^2 / w} but with the height for each color calculated from the colormap.

Parameters:

v : float

The value at which the Gaussian is to be added.

w : float

The relative width (w in the above equation.)

alpha : float, optional

The alpha value height for the Gaussian

colormap : string, optional

An acceptable colormap. See either yt.visualization.color_maps or http://www.scipy.org/Cookbook/Matplotlib/Show_colormaps .

col_bounds: array_like [min, max], optional :

Limits the values over which the colormap spans to these values. Useful for sampling an entire colormap over a range smaller than the transfer function bounds.

See also

ColorTransferFunction.add_layers
Many-at-a-time adder

Examples

>>> tf = ColorTransferFunction( (-10.0, -5.0) )
>>> tf.sample_colormap(-7.0, 0.01, colormap='algae')