pyvista.ImageData.point_data

pyvista.ImageData.point_data#

property ImageData.point_data: DataSetAttributes[source]#

Return point data as DataSetAttributes.

Returns:
DataSetAttributes

Point data as DataSetAttributes.

Examples

Add point arrays to a mesh and list the available point_data.

>>> import pyvista as pv
>>> import numpy as np
>>> mesh = pv.Cube()
>>> mesh.clear_data()
>>> mesh.point_data['my_array'] = np.random.default_rng().random(
...     mesh.n_points
... )
>>> mesh.point_data['my_other_array'] = np.arange(mesh.n_points)
>>> mesh.point_data
pyvista DataSetAttributes
Association     : POINT
Active Scalars  : my_array
Active Vectors  : None
Active Texture  : None
Active Normals  : None
Contains arrays :
    my_array                float64    (8,)                 SCALARS
    my_other_array          int64      (8,)

Access an array from point_data.

>>> mesh.point_data['my_other_array']
pyvista_ndarray([0, 1, 2, 3, 4, 5, 6, 7])

Or access it directly from the mesh.

>>> mesh['my_array'].shape
(8,)