pyvista.DataSetAttributes.active_scalars#

property DataSetAttributes.active_scalars: pyvista_ndarray | None[source]#

Return the active scalars.

Changed in version 0.32.0: Can no longer be used to set the active scalars. Either use DataSetAttributes.set_scalars() or if the array already exists, assign to pyvista.DataSetAttributes.active_scalars_name.

Returns:
Optional[pyvista_ndarray]

Active scalars.

Examples

Associate point data to a simple cube mesh and show that the active scalars in the point array are the most recently added array.

>>> import pyvista as pv
>>> import numpy as np
>>> mesh = pv.Cube()
>>> mesh.point_data['data0'] = np.arange(mesh.n_points)
>>> mesh.point_data.active_scalars
pyvista_ndarray([0, 1, 2, 3, 4, 5, 6, 7])