pyvista.LookupTable.ramp#

property LookupTable.ramp: str[source]#

Set the shape of the table ramp.

This attribute is only used when creating custom color maps and will return None when a color map has been set with LookupTable.cmap. This will clear any existing color map and create new values for the lookup table when set.

This value may be either "s-curve", "linear", or "sqrt".

  • The default is S-curve, which tails off gradually at either end.

  • The equation used for "s-curve" is y = (sin((x - 1/2)*pi) + 1)/2, For an S-curve greyscale ramp, you should set pyvista.LookupTable.n_values` to 402 (which is 256*pi/2) to provide room for the tails of the ramp.

  • The equation for the "linear" is simply y = x.

  • The equation for the "sqrt" is y = sqrt(x).

Examples

Show the default s-curve ramp.

>>> import pyvista as pv
>>> lut = pv.LookupTable()
>>> lut.hue_range = (0.0, 0.33)
>>> lut.ramp = 's-curve'
>>> lut.plot()
../../../_images/pyvista-LookupTable-ramp-1_00_00.png

Plot the linear ramp.

>>> import pyvista as pv
>>> lut = pv.LookupTable()
>>> lut.hue_range = (0.0, 0.33)
>>> lut.ramp = 'linear'
>>> lut.plot()
../../../_images/pyvista-LookupTable-ramp-1_01_00.png

Plot the "sqrt" ramp.

>>> import pyvista as pv
>>> lut = pv.LookupTable()
>>> lut.hue_range = (0.0, 0.33)
>>> lut.ramp = 'sqrt'
>>> lut.plot()
../../../_images/pyvista-LookupTable-ramp-1_02_00.png