PointGaussianMapper.scale_array

Contents

PointGaussianMapper.scale_array#

property PointGaussianMapper.scale_array: str[source]#

Set or return the name of the array used to scale the splats.

Scalars used to scale the gaussian points. Accepts a string name of an array that is present on the mesh.

Notes

Setting this automatically sets scale_factor = 1.0.

Examples

Plot spheres using style=’points_gaussian’ style and scale them by radius.

>>> import numpy as np
>>> import pyvista as pv
>>> n_spheres = 1_000
>>> rng = np.random.default_rng(seed=0)
>>> pos = rng.random((n_spheres, 3))
>>> rad = rng.random(n_spheres) * 0.01
>>> pdata = pv.PolyData(pos)
>>> pdata['radius'] = rad
>>> pl = pv.Plotter()
>>> actor = pl.add_mesh(
...     pdata,
...     style='points_gaussian',
...     emissive=False,
...     render_points_as_spheres=True,
... )
>>> actor.mapper.scale_array = 'radius'
>>> pl.show()
../../../_images/pyvista-plotting-mapper-PointGaussianMapper-scale_array-a22deac2644ed137_00_00.png