yt.extensions.volume_rendering.ColorTransferFunction.sample_colormap

ColorTransferFunction.sample_colormap(v, w, alpha=None, colormap='gist_stern')

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 raven.color_maps or http://www.scipy.org/Cookbook/Matplotlib/Show_colormaps .

See also

ColorTransferFunction.add_layers
Many-at-a-time adder

Examples

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

Previous topic

yt.extensions.volume_rendering.ColorTransferFunction.plot

Next topic

yt.extensions.volume_rendering.HomogenizedVolume

This Page