General Utilities#

utilities.VtkErrorCatcher([raise_errors, ...])

Context manager to temporarily catch VTK errors.

utilities.axis_rotation(points, angle[, ...])

Rotate points by angle about an axis.

utilities.is_inside_bounds(point, bounds)

Check if a point is inside a set of bounds.


Set a file to write out the VTK errors.

Object Conversions or Wrapping#


Convert a vtk matrix to an array.

cubemap([path, prefix, ext])

Construct a cubemap from 6 images from a directory.


Construct a cubemap from 6 images.


Convert vtkImageData (pyvista.UniformGrid) to a vtkTexture.


Return True if the object is a PyVista wrapped dataset.


Convert a NumPy image array to a vtk.vtkTexture.

pyvista_ndarray(array[, dataset, association])

An ndarray which references the owning dataset and the underlying vtkArray.


Convert a numpy.ndarray or array-like to a vtk matrix.


Wrap any given VTK data object to its appropriate PyVista data object.

File IO#

read(filename[, attrs, force_ext, ...])

Read any file type supported by vtk or meshio.

read_exodus(filename[, animate_mode_shapes, ...])

Read an ExodusII file ('.e' or '.exo').

read_legacy(filename[, progress_bar])

Use VTK's legacy reader to read a file.

read_texture(filename[, attrs, progress_bar])

Load a texture from an image file.

save_meshio(filename, mesh[, file_format])

Save mesh to file using meshio.

Mesh Creation#


Define types of cells.

fit_plane_to_points(points[, return_meta])

Fit a plane to a set of points using the SVD algorithm.

lines_from_points(points[, close])

Make a connected line set given an array of points.

vector_poly_data(orig, vec)

Create a pyvista.PolyData object composed of vectors.

vtk_points(points[, deep, force_float])

Convert numpy array or array-like to a vtkPoints object.

Array Access#

cell_array(obj, name)

Return cell array of a pyvista or vtk object.

convert_array(arr[, name, deep, array_type])

Convert a NumPy array to a vtkDataArray or vice versa.

field_array(obj, name)

Return field data of a pyvista or vtk object.

get_array(mesh, name[, preference, err])

Search point, cell and field data for an array.

point_array(obj, name)

Return point array of a pyvista or vtk object.

Image Comparison and Regression#

compare_images(im1, im2[, threshold, use_vtk])

Compare two different images of the same size.


Color([color, opacity, default_color, ...])

Helper class to convert between different color representations used in the pyvista library.


Any object convertible to a Color.

start_xvfb([wait, window_size])

Start the virtual framebuffer Xvfb.

Report([additional, ncol, text_width, sort, gpu])

Generate a PyVista software environment report.

VTK Version Information#

The PyVista library is heavily dependent on VTK and provides an easy way of getting the version of VTK in your environment.

Output the version of VTK.

>>> import pyvista
>>> pyvista.vtk_version_info
VTKVersionInfo(major=9, minor=1, micro=0)

Get the major version of VTK

>>> pyvista.vtk_version_info.major