Introduction#

This section includes a brief explanation of the background and history of PyVista.

Tip

This section of the tutorial was adopted from Getting Started chapter of the PyVista documentation.

PyVista is one of many visualization libraries built on top VTK - The Visualization Toolkit. It’s primary intent was to be an abstraction layer over VTK to provide convenience and functionality to VTK exposed “Pythonically”.

Brief History#

PyVista was created out of a desire to make a reusable higher level abstraction layer that “wraps” the lower level functionality of VTK.

PyPIact condaact contributors GitHub

Who is PyVista for?#

Anyone who wants to visualize 3D data using Python.

Here’s how people are using PyVista:

Feel free to write about what you have achieved with PyVista or what you would like to achieve in the future.

Brief Examples#

Read a Surface Mesh and Plot it#

VTK is powerful, really powerful! You can do just about anything within VTK and PyVista just wants to make it easier to do it using numpy-like and Matplotlib-like syntax. For example, if you wanted to be able to plot a simple surface mesh:

Load and plot a surface dataset

Using vtk

Using PyVista

import vtk
reader = vtk.vtkSTLReader()
reader.SetFileName("bunny.stl")
mapper = vtk.vtkPolyDataMapper()
output_port = reader.GetOutputPort()
mapper.SetInputConnection(output_port)
actor = vtk.vtkActor()
actor.SetMapper(mapper)
ren = vtk.vtkRenderer()
renWin = vtk.vtkRenderWindow()
renWin.AddRenderer(ren)
iren = vtk.vtkRenderWindowInteractor()
iren.SetRenderWindow(renWin)
ren.AddActor(actor)
iren.Initialize()
renWin.Render()
iren.Start()
del iren, renWin
from pyvista import examples
mesh = examples.download_bunny()
mesh.plot(cpos='xy')