yt.visualization.volume_rendering.transfer_functions.ColorTransferFunction.map_to_colormap

ColorTransferFunction.map_to_colormap(mi, ma, scale=1.0, colormap='gist_stern', scale_func=None)[source]

Map a range of values to a full colormap.

Given a minimum and maximum value in the TransferFunction, map a full colormap over that range at an alpha level of scale. Optionally specify a scale_func function that modifies the alpha as a function of the transfer function value.

Parameters:

mi : float

The start of the TransferFunction to map the colormap

ma : float

The end of the TransferFunction to map the colormap

scale: float, optional :

The alpha value to be used for the height of the transfer function. Larger values will be more opaque.

colormap : string, optional

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

scale_func: function(value, minval, maxval), optional :

A user-defined function that can be used to scale the alpha channel as a function of the TransferFunction field values. Function maps value to somewhere between minval and maxval.

Examples

>>> def linramp(vals, minval, maxval):
...     return (vals - vals.min())/(vals.(max) - vals.min())
>>> tf = ColorTransferFunction( (-10.0, -5.0) )
>>> tf.map_to_colormap(-8.0, -6.0, scale=10.0, colormap='algae')
>>> tf.map_to_colormap(-6.0, -5.0, scale=10.0, colormap='algae',
...                    scale_func = linramp)