Typing#

Type aliases 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.ColorLike, is deprecated. Use pyvista.typing.ColorLike instead.

Deprecated since version 0.50: pyvista.Number, pyvista.NumberType and pyvista.NumpyArray are deprecated. Use float, a TypeVar and numpy.typing.NDArray instead.

Deprecated since version 0.50: pyvista.ArrayLike, pyvista.MatrixLike and pyvista.VectorLike are deprecated. Use the Float, Int or Bool array-like types instead, for example VectorLikeFloat in place of VectorLike[float].

Numeric Array-Like Types#

Each array-like accepts NumPy arrays and sequences of one kind of value. As in Python type hints, Float means float, which also accepts int and bool, so the Float types accept integer and boolean arrays too; likewise the Int types accept boolean arrays. A sequence holds either Python values or NumPy scalars, not a mix of both, and a lone scalar or zero-dimensional array is not array-like. Complex, string, and object arrays are not included; annotate an input that accepts them as NDArray[Any] | Sequence[Any].

pyvista.typing.VectorLikeFloat#

One-dimensional array-like object with numerical values.

Accepts NumPy arrays of numpy.floating, numpy.integer or numpy.bool dtype, and sequences of float, int and bool values or of NumPy scalars of those dtypes.

Includes sequences and one-dimensional NumPy arrays.

VectorLikeFloat = collections.abc.Sequence[float] | collections.abc.Sequence[numpy.floating | numpy.integer | numpy.bool] | numpy.ndarray[tuple[int], numpy.dtype[numpy.floating | numpy.integer | numpy.bool]]#

pyvista.typing.VectorLikeInt#

One-dimensional array-like object with integer values.

Accepts NumPy arrays of numpy.integer or numpy.bool dtype, and sequences of int and bool values or of NumPy scalars of those dtypes. Floating values are not included.

Includes sequences and one-dimensional NumPy arrays.

VectorLikeInt = collections.abc.Sequence[int] | collections.abc.Sequence[numpy.integer | numpy.bool] | numpy.ndarray[tuple[int], numpy.dtype[numpy.integer | numpy.bool]]#

pyvista.typing.VectorLikeBool#

One-dimensional array-like object with boolean values.

Accepts NumPy arrays of numpy.bool dtype and sequences of bool values or of numpy.bool scalars only. Integer and floating values are not included.

Includes sequences and one-dimensional NumPy arrays.

VectorLikeBool = collections.abc.Sequence[bool] | collections.abc.Sequence[numpy.bool] | numpy.ndarray[tuple[int], numpy.dtype[numpy.bool]]#

pyvista.typing.MatrixLikeFloat#

Two-dimensional array-like object with numerical values.

Accepts NumPy arrays of numpy.floating, numpy.integer or numpy.bool dtype, and sequences of float, int and bool values or of NumPy scalars of those dtypes.

Includes sequences of vectors and two-dimensional NumPy arrays.

MatrixLikeFloat = collections.abc.Sequence[collections.abc.Sequence[float]] | collections.abc.Sequence[collections.abc.Sequence[numpy.floating | numpy.integer | numpy.bool] | numpy.ndarray[tuple[int], numpy.dtype[numpy.floating | numpy.integer | numpy.bool]]] | numpy.ndarray[tuple[int, int], numpy.dtype[numpy.floating | numpy.integer | numpy.bool]]#

pyvista.typing.MatrixLikeInt#

Two-dimensional array-like object with integer values.

Accepts NumPy arrays of numpy.integer or numpy.bool dtype, and sequences of int and bool values or of NumPy scalars of those dtypes. Floating values are not included.

Includes sequences of vectors and two-dimensional NumPy arrays.

MatrixLikeInt = collections.abc.Sequence[collections.abc.Sequence[int]] | collections.abc.Sequence[collections.abc.Sequence[numpy.integer | numpy.bool] | numpy.ndarray[tuple[int], numpy.dtype[numpy.integer | numpy.bool]]] | numpy.ndarray[tuple[int, int], numpy.dtype[numpy.integer | numpy.bool]]#

pyvista.typing.MatrixLikeBool#

Two-dimensional array-like object with boolean values.

Accepts NumPy arrays of numpy.bool dtype and sequences of bool values or of numpy.bool scalars only. Integer and floating values are not included.

Includes sequences of vectors and two-dimensional NumPy arrays.

MatrixLikeBool = collections.abc.Sequence[collections.abc.Sequence[bool]] | collections.abc.Sequence[collections.abc.Sequence[numpy.bool] | numpy.ndarray[tuple[int], numpy.dtype[numpy.bool]]] | numpy.ndarray[tuple[int, int], numpy.dtype[numpy.bool]]#

pyvista.typing.ArrayLikeFloat#

Any-dimensional array-like object with numerical values.

Accepts NumPy arrays of numpy.floating, numpy.integer or numpy.bool dtype, and sequences of float, int and bool values or of NumPy scalars of those dtypes.

Includes NumPy arrays and sequences nested up to four deep. Scalar values are not included.

ArrayLikeFloat = collections.abc.Sequence[float | collections.abc.Sequence[float] | collections.abc.Sequence[float | collections.abc.Sequence[float]] | collections.abc.Sequence[float | collections.abc.Sequence[float] | collections.abc.Sequence[float | collections.abc.Sequence[float]]]] | collections.abc.Sequence[numpy.floating | numpy.integer | numpy.bool | NDArray[numpy.floating | numpy.integer | numpy.bool] | collections.abc.Sequence[numpy.floating | numpy.integer | numpy.bool | NDArray[numpy.floating | numpy.integer | numpy.bool]] | collections.abc.Sequence[numpy.floating | numpy.integer | numpy.bool | NDArray[numpy.floating | numpy.integer | numpy.bool] | collections.abc.Sequence[numpy.floating | numpy.integer | numpy.bool | NDArray[numpy.floating | numpy.integer | numpy.bool]]] | collections.abc.Sequence[numpy.floating | numpy.integer | numpy.bool | NDArray[numpy.floating | numpy.integer | numpy.bool] | collections.abc.Sequence[numpy.floating | numpy.integer | numpy.bool | NDArray[numpy.floating | numpy.integer | numpy.bool]] | collections.abc.Sequence[numpy.floating | numpy.integer | numpy.bool | NDArray[numpy.floating | numpy.integer | numpy.bool] | collections.abc.Sequence[numpy.floating | numpy.integer | numpy.bool | NDArray[numpy.floating | numpy.integer | numpy.bool]]]]] | numpy.ndarray[tuple[int, typing.Unpack[tuple[int, ...]]], numpy.dtype[numpy.floating | numpy.integer | numpy.bool]]#

pyvista.typing.ArrayLikeInt#

Any-dimensional array-like object with integer values.

Accepts NumPy arrays of numpy.integer or numpy.bool dtype, and sequences of int and bool values or of NumPy scalars of those dtypes. Floating values are not included.

Includes NumPy arrays and sequences nested up to four deep. Scalar values are not included.

ArrayLikeInt = collections.abc.Sequence[int | collections.abc.Sequence[int] | collections.abc.Sequence[int | collections.abc.Sequence[int]] | collections.abc.Sequence[int | collections.abc.Sequence[int] | collections.abc.Sequence[int | collections.abc.Sequence[int]]]] | collections.abc.Sequence[numpy.integer | numpy.bool | NDArray[numpy.integer | numpy.bool] | collections.abc.Sequence[numpy.integer | numpy.bool | NDArray[numpy.integer | numpy.bool]] | collections.abc.Sequence[numpy.integer | numpy.bool | NDArray[numpy.integer | numpy.bool] | collections.abc.Sequence[numpy.integer | numpy.bool | NDArray[numpy.integer | numpy.bool]]] | collections.abc.Sequence[numpy.integer | numpy.bool | NDArray[numpy.integer | numpy.bool] | collections.abc.Sequence[numpy.integer | numpy.bool | NDArray[numpy.integer | numpy.bool]] | collections.abc.Sequence[numpy.integer | numpy.bool | NDArray[numpy.integer | numpy.bool] | collections.abc.Sequence[numpy.integer | numpy.bool | NDArray[numpy.integer | numpy.bool]]]]] | numpy.ndarray[tuple[int, typing.Unpack[tuple[int, ...]]], numpy.dtype[numpy.integer | numpy.bool]]#

pyvista.typing.ArrayLikeBool#

Any-dimensional array-like object with boolean values.

Accepts NumPy arrays of numpy.bool dtype and sequences of bool values or of numpy.bool scalars only. Integer and floating values are not included.

Includes NumPy arrays and sequences nested up to four deep. Scalar values are not included.

ArrayLikeBool = collections.abc.Sequence[bool | collections.abc.Sequence[bool] | collections.abc.Sequence[bool | collections.abc.Sequence[bool]] | collections.abc.Sequence[bool | collections.abc.Sequence[bool] | collections.abc.Sequence[bool | collections.abc.Sequence[bool]]]] | collections.abc.Sequence[numpy.bool | NDArray[numpy.bool] | collections.abc.Sequence[numpy.bool | NDArray[numpy.bool]] | collections.abc.Sequence[numpy.bool | NDArray[numpy.bool] | collections.abc.Sequence[numpy.bool | NDArray[numpy.bool]]] | collections.abc.Sequence[numpy.bool | NDArray[numpy.bool] | collections.abc.Sequence[numpy.bool | NDArray[numpy.bool]] | collections.abc.Sequence[numpy.bool | NDArray[numpy.bool] | collections.abc.Sequence[numpy.bool | NDArray[numpy.bool]]]]] | numpy.ndarray[tuple[int, typing.Unpack[tuple[int, ...]]], numpy.dtype[numpy.bool]]#

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[numpy.floating] | NDArray[numpy.integer] | 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 plot() or add_mesh().

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

PlottableType = vtkmodules.vtkCommonDataModel.vtkDataSet | vtkmodules.vtkCommonDataModel.vtkMultiBlockDataSet | vtkmodules.vtkCommonDataModel.vtkPartitionedDataSet | ForwardRef('DataSet') | ForwardRef('MultiBlock') | ForwardRef('PartitionedDataSet') | NDArray[numpy.float64 | numpy.float32 | numpy.float16 | numpy.int64 | numpy.int32 | numpy.int16 | numpy.int8 | numpy.uint64 | numpy.uint32 | numpy.uint16 | numpy.uint8 | numpy.bool | numpy.complex64 | numpy.complex128] | collections.abc.Sequence[float] | collections.abc.Sequence[numpy.floating | numpy.integer | numpy.bool] | numpy.ndarray[tuple[int], numpy.dtype[numpy.floating | numpy.integer | numpy.bool]] | collections.abc.Sequence[collections.abc.Sequence[float]] | collections.abc.Sequence[collections.abc.Sequence[numpy.floating | numpy.integer | numpy.bool] | numpy.ndarray[tuple[int], numpy.dtype[numpy.floating | numpy.integer | numpy.bool]]] | numpy.ndarray[tuple[int, int], numpy.dtype[numpy.floating | numpy.integer | numpy.bool]] | ForwardRef('trimesh.Trimesh') | ForwardRef('meshio.Mesh') | str | pathlib.Path#