PyVista

0.47.3 · active · verified Sat Apr 11

PyVista is a high-level Pythonic interface to the Visualization Toolkit (VTK), simplifying 3D plotting, mesh data structures, and filtering methods for spatial datasets. It is an active project, currently at version 0.47.3, with frequent patch releases and minor versions addressing bugs and introducing new features.

Warnings

Install

Imports

Quickstart

This example demonstrates how to download a sample 3D mesh, assign scalar data to its points for coloring, and then visualize it using PyVista's `Plotter` with a specified colormap and camera position.

import pyvista as pv
from pyvista import examples

# Download and load an example mesh (e.g., the Stanford dragon)
mesh = examples.download_dragon()

# Add scalar data based on point coordinates for coloring
mesh['scalars'] = mesh.points[:, 1]

# Create a plotter and add the mesh
plotter = pv.Plotter()
plotter.add_mesh(mesh, cmap='plasma', show_edges=True)

# Set the camera position and display the plot
plotter.show(cpos='xy')

view raw JSON →