set_default_active_scalars

set_default_active_scalars#

set_default_active_scalars(mesh: DataSet) _ActiveArrayExistsInfoTuple[source]#

Set a default scalars array on mesh, if not already set.

If an active scalars already exists, no changes are made.

If an active scalars does not exist, it checks for point or cell arrays. If only one exists, then it is set as the active scalars. Otherwise, an error is raised.

Changed in version 0.45: The field and name of the active array is now returned. Previously, None was returned.

Parameters:
meshpyvista.DataSet

Dataset to set default active scalars.

Returns:
tuple[FieldAssociation, str]

The field and name of the active array.

Raises:
pyvista.core.errors.MissingDataError

If no arrays exist.

pyvista.core.errors.AmbiguousDataError

If more than one array exists.