pyvista.plotting.volume_property.VolumeProperty.apply_lookup_table#
- VolumeProperty.apply_lookup_table(
- lookup_table: LookupTable,
Apply a lookup table to the volume property.
Applies both the color and opacity of the lookup table as transfer functions.
- Parameters:
- lookup_table
pyvista.LookupTable
,optional
Lookup table to set the color and opacity transfer functions.
- lookup_table
Examples
Plot perlin noise volumetrically using a custom lookup table.
>>> import pyvista as pv >>> noise = pv.perlin_noise(1, (1, 3, 5), (0, 0, 0)) >>> grid = pv.sample_function( ... noise, [0, 3.0, -0, 1.0, 0, 1.0], dim=(40, 40, 40) ... ) >>> grid['scalars'] -= grid['scalars'].min() >>> grid['scalars'] *= 255 / grid['scalars'].max() >>> pl = pv.Plotter() >>> actor = pl.add_volume(grid, show_scalar_bar=False) >>> lut = pv.LookupTable(cmap='bwr') >>> lut.apply_opacity([1.0, 0.0, 0.0, 0.3, 0.0, 0.0, 0.0, 0.3]) >>> actor.prop.apply_lookup_table(lut) >>> pl.show()