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.
Originally created as a sub-libary for femorph by @akaszynski in 2016.
First posted to GitHub as akaszynski/vtki back in 2017.
@banesullivan joined the project in 2018 to expand functionality, features, and improve the documentation with examples.
First release of PyVista on PyPI in 2019.
Now over 100+ contributors and ~1.4k Stars on GitHub!
Greatly expanded internal presence and continuing support thanks to
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 |
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')
|