Typing#

Type aliases and type variable for annotating code that uses PyVista.

Added in version 0.50: The pyvista.typing module.

Deprecated since version 0.50: Accessing these aliases from pyvista, for example pyvista.VectorLike, is deprecated. Use pyvista.typing.VectorLike instead.

Numeric Array-Like Types#

pyvista.typing.NumberType#

Type variable for numeric data types.

NumberType = TypeVar(NumberType, bound=Union)#

Type:    TypeVar

Invariant TypeVar bound to typing.Union[numpy.floating, numpy.integer, numpy.bool, float, int, bool].

pyvista.typing.Number#

Integer or float value.

Number = int | float#

pyvista.typing.ArrayLike#

Any-dimensional array-like object with numerical values.

Includes sequences, nested sequences, and numpy arrays. Scalar values are not included.

ArrayLike = NDArray[~NumberType] | collections.abc.Sequence[~NumberType] | collections.abc.Sequence[NDArray[~NumberType]] | collections.abc.Sequence[collections.abc.Sequence[~NumberType]] | collections.abc.Sequence[collections.abc.Sequence[NDArray[~NumberType]]] | collections.abc.Sequence[collections.abc.Sequence[collections.abc.Sequence[~NumberType]]] | collections.abc.Sequence[collections.abc.Sequence[collections.abc.Sequence[NDArray[~NumberType]]]] | collections.abc.Sequence[collections.abc.Sequence[collections.abc.Sequence[collections.abc.Sequence[~NumberType]]]] | collections.abc.Sequence[collections.abc.Sequence[collections.abc.Sequence[collections.abc.Sequence[NDArray[~NumberType]]]]]#

pyvista.typing.MatrixLike#

Two-dimensional array-like object with numerical values.

Includes singly nested sequences and numpy arrays.

MatrixLike = NDArray[~NumberType] | collections.abc.Sequence[collections.abc.Sequence[~NumberType]] | collections.abc.Sequence[collections.abc.Sequence[NDArray[~NumberType]]]#

pyvista.typing.VectorLike#

One-dimensional array-like object with numerical values.

Includes sequences and numpy arrays.

VectorLike = NDArray[~NumberType] | collections.abc.Sequence[~NumberType] | collections.abc.Sequence[NDArray[~NumberType]]#

Plotting Types#

pyvista.typing.ColorLike#

Any object that can be converted to a Color.

ColorLike = tuple[int, int, int] | tuple[int, int, int, int] | tuple[float, float, float] | tuple[float, float, float, float] | collections.abc.Sequence[int] | collections.abc.Sequence[float] | NDArray[float] | dict[str, int | float | str] | str | ForwardRef('Color') | vtkmodules.vtkCommonDataModel.vtkColor3ub | ForwardRef('_ALL_COLORS_LITERAL')#

pyvista.typing.Chart#

Any of Chart2D, ChartBox, ChartPie or ChartMPL, as accepted by add_chart().

Chart#

pyvista.typing.PlottableType#

Object accepted by pyvista.plot() or pyvista.Plotter.add_mesh().

Includes PyVista and VTK datasets and composite datasets, trimesh and meshio meshes, NumPy arrays of points or of volume values, and the path of a mesh file.

PlottableType = NDArray[float] | collections.abc.Sequence[float] | collections.abc.Sequence[NDArray[float]] | collections.abc.Sequence[collections.abc.Sequence[float]] | collections.abc.Sequence[collections.abc.Sequence[NDArray[float]]] | collections.abc.Sequence[collections.abc.Sequence[collections.abc.Sequence[float]]] | collections.abc.Sequence[collections.abc.Sequence[collections.abc.Sequence[NDArray[float]]]] | collections.abc.Sequence[collections.abc.Sequence[collections.abc.Sequence[collections.abc.Sequence[float]]]] | collections.abc.Sequence[collections.abc.Sequence[collections.abc.Sequence[collections.abc.Sequence[NDArray[float]]]]] | vtkmodules.vtkCommonDataModel.vtkDataObject | ForwardRef('DataObject') | vtkmodules.vtkCommonCore.vtkDataArray | ForwardRef('trimesh.Trimesh') | ForwardRef('meshio.Mesh') | str | pathlib.Path#