Theme.interpolate_before_map

Theme.interpolate_before_map#

property Theme.interpolate_before_map: bool[source]#

Return or set whether to interpolate colors before mapping.

If the interpolate_before_map is turned off, the color mapping occurs at polygon points and colors are interpolated, which is generally less accurate whereas if the interpolate_before_map is on (the default), then the scalars will be interpolated across the topology of the dataset which is more accurate.

See also Interpolate Before Mapping.

Examples#

Download Python source code | Download Jupyter notebook

Enable hidden line removal.

>>> import pyvista as pv

Load a cylinder which has cells with a wide spread

>>> cyl = pv.Cylinder(direction=(0, 0, 1), height=2).elevation()

Common display argument to make sure all else is constant

>>> dargs = dict(scalars='Elevation', cmap='rainbow', show_edges=True)
>>> pl = pv.Plotter(shape=(1, 2))
>>> _ = pl.add_mesh(
...     cyl,
...     interpolate_before_map=False,
...     scalar_bar_args={'title': 'Elevation - interpolated'},
...     **dargs,
... )
>>> pl.subplot(0, 1)
>>> _ = pl.add_mesh(
...     cyl,
...     interpolate_before_map=True,
...     scalar_bar_args={'title': 'Elevation - interpolated'},
...     **dargs,
... )
>>> pl.link_views()
>>> pl.camera_position = pv.CameraPosition(
...     position=(-1.67, -5.10, 2.06),
...     focal_point=(0.0, 0.0, 0.0),
...     viewup=(0.00, 0.37, 0.93),
... )
>>> pl.show()
../../../_images/pyvista-plotting-themes-Theme-interpolate_before_map-d5757f3f88f2caca_00_00.png