pyvista.plotting.mapper._BaseMapper.interpolate_before_map

pyvista.plotting.mapper._BaseMapper.interpolate_before_map#

property _BaseMapper.interpolate_before_map: bool[source]#

Return or set the interpolation of scalars before mapping.

Enabling makes for a smoother scalars display. When False, OpenGL will interpolate the mapped colors which can result in showing colors that are not present in the color map.

Examples

Disable interpolation before mapping.

>>> import pyvista as pv
>>> dataset = pv.MultiBlock(
...     [pv.Cube(), pv.Sphere(center=(0, 0, 1))]
... )
>>> dataset[0].point_data['data'] = dataset[0].points[:, 2]
>>> dataset[1].point_data['data'] = dataset[1].points[:, 2]
>>> pl = pv.Plotter()
>>> actor, mapper = pl.add_composite(
...     dataset,
...     show_scalar_bar=False,
...     n_colors=3,
...     cmap='bwr',
... )
>>> mapper.interpolate_before_map = False
>>> pl.show()
../../../_images/pyvista-plotting-mapper-_BaseMapper-interpolate_before_map-1_00_00.png

Enable interpolation before mapping.

>>> pl = pv.Plotter()
>>> actor, mapper = pl.add_composite(
...     dataset,
...     show_scalar_bar=False,
...     n_colors=3,
...     cmap='bwr',
... )
>>> mapper.interpolate_before_map = True
>>> pl.show()
../../../_images/pyvista-plotting-mapper-_BaseMapper-interpolate_before_map-1_01_00.png

See Interpolate Before Mapping for additional explanation regarding this attribute.