This section details the general usage of PyVista for users who may or may not have used VTK in the past, but are looking to leverage it in a Pythonic manner for 3D plotting. See the table of contents below or the in the side panel for the individual sections demonstrating the key concepts of PyVista.
Simple Interactive Example#
This basic example demonstrates three key features of PyVista:
Variety of built-in examples
Intuitive plotting with keyword arguments.
Here, we download the Stanford dragon mesh, color it according to height, and plot it using a web-viewer. This same example will run identically locally.
>>> from pyvista import examples >>> mesh = examples.download_dragon() >>> mesh['scalars'] = mesh.points[:, 1] >>> mesh.plot(cpos='xy', cmap='plasma', pbr=True, metallic=1.0, roughness=0.6, ... zoom=1.7)
This example (and many others) is interactive!
With just a few lines of code we downloaded a sample mesh from the web, added scalars to it based on the points of the mesh, and plotted it while controlling the orientation, color, and data presented in the visualization.
The following sections explain the details of the how and why of PyVista’s interface.
User Guide Contents#
- What is a Mesh?
- Basic API Usage
- PyVista Data Model
- Transitioning from VTK to PyVista
- Plotting Themes
- Jupyter Notebook Plotting
- Optional Features
Here are some videos that you can watch to learn PyVista:
PyConJP2020 talk “How to plot unstructured mesh file on Jupyter Notebook” (15 minutes):
Software Underground Tutorial
If there is any material that we can add, please open an issue .