VolumeProperty.apply_lookup_table#
- VolumeProperty.apply_lookup_table(lookup_table: LookupTable)[source]#
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#
Download Python source code | Download Jupyter notebook
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, bounds=[0, 3.0, -0, 1.0, 0, 1.0], dim=(40, 40, 40)
... )
>>> pl = pv.Plotter()
>>> actor = pl.add_volume(grid, show_scalar_bar=False)
>>> lut = actor.mapper.lookup_table
>>> lut.cmap = 'bwr'
>>> lut.apply_opacity([1.0, 0.0, 0.0, 0.3, 0.0, 0.0, 0.0, 0.3])
>>> pl.show()