pyvista.LookupTable#
- class LookupTable(*args, **kwargs)[source]#
Scalar to RGBA mapping table.
A lookup table is an array that maps input values to output values. When plotting data over a dataset, it is necessary to map those scalars to colors (in the RGBA format), and this class provides the functionality to do so.
See vtkLookupTable for more details regarding the underlying VTK API.
- Parameters:
- cmap
str|matplotlib.colors.Colormap,optional Color map from
matplotlib,colorcet, orcmocean. Eithercmaporvaluescan be set, but not both. See Named Colormaps for supported colormaps.- n_values
int, default: 256 Number of colors in the color map.
- flipbool, default:
False Flip the direction of cmap. Most colormaps allow
*_rsuffix to do this as well.- valuesarray_like[
float],optional Lookup table values. Either
valuesorcmapcan be set, but not both.- value_range
tuple,optional The range of the brightness of the mapped lookup table. This range is only used when creating custom color maps and will be ignored if
cmapis set.- hue_range
tuple,optional Lookup table hue range. This range is only used when creating custom color maps and will be ignored if
cmapis set.- alpha_range
tuple,optional Lookup table alpha (transparency) range. This range is only used when creating custom color maps and will be ignored if
cmapis set.- scalar_range
tuple,optional The range of scalars which will be mapped to colors. Values outside of this range will be colored according to
LookupTable.below_range_colorandLookupTable.above_range_color.- log_scalebool,
optional Use a log scale when mapping scalar values.
- nan_color
ColorLike,optional Color to render any values that are NANs.
- above_range_color
ColorLike,optional Color to render any values above
LookupTable.scalar_range.- below_range_color
ColorLike,optional Color to render any values below
LookupTable.scalar_range.- ramp
str,optional The shape of the table ramp. This range is only used when creating custom color maps and will be ignored if
cmapis set.- annotations
dict,optional A dictionary of annotations. Keys are the float values in the scalars range to annotate on the scalar bar and the values are the string annotations.
- cmap
See also
Examples
Plot the lookup table with the default VTK color map.
>>> import pyvista as pv >>> lut = pv.LookupTable() >>> lut LookupTable (...) Table Range: (0.0, 1.0) N Values: 256 Above Range Color: None Below Range Color: None NAN Color: Color(name='maroon', hex='#800000ff', opacity=255) Log Scale: False Color Map: "PyVista Lookup Table" Alpha Range: (1.0, 1.0) Hue Range: (0.0, 0.66667) Saturation Range (1.0, 1.0) Value Range (1.0, 1.0) Ramp s-curve >>> lut.plot()
Plot the lookup table with the
'inferno'color map.>>> import pyvista as pv >>> lut = pv.LookupTable('inferno', n_values=32) >>> lut LookupTable (...) Table Range: (0.0, 1.0) N Values: 32 Above Range Color: None Below Range Color: None NAN Color: Color(name='maroon', hex='#800000ff', opacity=255) Log Scale: False Color Map: "inferno" >>> lut.plot()
Methods#
|
Assign a colormap to this lookup table. |
|
Assign custom opacity to this lookup table. |
|
Map a single value through the lookup table, returning an RBG(A) color. |
|
Plot this lookup table. |
Clear the color map and recompute the values table. |
|
Return the VTK color transfer function of this table. |
|
|
Return the opacity transfer function of this table. |
Attributes#
Return or set the above range color. |
|
Return or set the above range opacity. |
|
Return or set the alpha range. |
|
Return or set annotations. |
|
Return or set the below range color. |
|
Return or set the below range opacity. |
|
Return or set the color map used by this lookup table. |
|
Return or set the hue range. |
|
Use log scale. |
|
Return or set the number of values in the lookup table. |
|
Return or set the not a number (NAN) color. |
|
Return or set the not a number (NAN) opacity. |
|
Set the shape of the table ramp. |
|
Return or set the saturation range. |
|
Return or set the table range. |
|
Return or set the brightness of the mapped lookup table. |
|
Return or set the lookup table values. |