Examples#

Here is a gallery of several examples demonstrating what PyVista can do.

All of these examples are live and available on MyBinder.

Launch on Binder

Mesh Creation#

These examples demo how to read various file types into PyVista mesh objects, create meshes from NumPy arrays, and how to create primitive geometric objects like spheres, arrows, cubes, ellipsoids and more.

Once a mesh is loaded, it is ready for plotting with just a few lines of code - explore these examples to get started with using PyVista for your data.

Image

Create Circular Arcs

Create Circular Arcs
Image

Drape 2D Surface From Line

Drape 2D Surface From Line
Image

Creating an Explicit Structured Grid

Creating an Explicit Structured Grid
Image

Geometric Objects

Geometric Objects
Image

Create a Kochanek Spline

Create a Kochanek Spline
Image

Create Connected Lines from Points

Create Connected Lines from Points
Image

Parametric Geometric Objects

Parametric Geometric Objects
Image

Pixel Art of ALIEN MONSTERS

Pixel Art of ALIEN MONSTERS
Image

Platonic Solids

Platonic Solids
Image

Create Point Cloud

Create Point Cloud
Image

Create a PointSet

Create a PointSet
Image

Create PolyData

Create PolyData
Image

Triangle Strips

Triangle Strips
Image

Unstructured Grid with Polyhedra

Unstructured Grid with Polyhedra
Image

Create Sphere Mesh Multiple Ways

Create Sphere Mesh Multiple Ways
Image

Creating a Spline

Creating a Spline
Image

Creating a Structured Surface

Creating a Structured Surface
Image

Create 3D Text

Create 3D Text
Image

Create Triangulated Surface

Create Triangulated Surface
Image

Plot Truss-like FEA Solution with Cylinders

Plot Truss-like FEA Solution with Cylinders
Image

Creating a Uniform Grid

Creating a Uniform Grid
Image

Creating an Unstructured Grid

Creating an Unstructured Grid
Image

Linear Cells

Linear Cells
Image

Working with glTF Files

Working with glTF Files
Image

Working with VRML Files

Working with VRML Files
Image

Read FEniCS/Dolfin Meshes

Read FEniCS/Dolfin Meshes
Image

Load and Plot from a File

Load and Plot from a File
Image

Read Image Files

Read Image Files
Image

Parallel Files

Parallel Files
Image

Load data using a Reader

Load data using a Reader
Image

Terrain Following Mesh

Terrain Following Mesh
Image

Wrapping Other Objects

Wrapping Other Objects

Filtering#

These examples show case various mesh analysis and filtering routines present in the Filters module. Explore these demos to perform tasks such as:

  • Slicing and cutting meshes

  • Computing mesh properties like volume, area, and surface normals

  • Mesh decimation

  • Extract regions of one mesh using another mesh’s surface

  • Ray tracing through surface meshes

  • Resampling and interpolating scalar/vector values across meshes

  • Integrating a vector field to generate streamlines

  • Smoothing surfaces

Image

Boolean Operations

Boolean Operations
Image

Extract Cell Centers

Extract Cell Centers
Image

Clip and Cap a Closed Surface

Clip and Cap a Closed Surface
Image

Clipping with Planes & Boxes

Clipping with Planes & Boxes
Image

Clipping with a Surface

Clipping with a Surface
Image

Collision

Collision
Image

Compare threshold filters

Compare threshold filters
Image

Computing Surface Normals

Computing Surface Normals
Image

Connectivity

Connectivity
Image

Contouring

Contouring
Image

Wrap a Point Cloud in a Convex Hull

Wrap a Point Cloud in a Convex Hull
Image

Crop Labeled ImageData

Crop Labeled ImageData
Image

Decimation

Decimation
Image

Distance Between Two Surfaces

Distance Between Two Surfaces
Image

Extract Cells Inside Surface

Extract Cells Inside Surface
Image

Extract Edges

Extract Edges
Image

Extract Surface

Extract Surface
Image

Extrude Rotation

Extrude Rotation
Image

Extrude Trim

Extrude Trim
Image

Farthest Point Sampling

Farthest Point Sampling
Image

Repair a Surface with fill_holes

Repair a Surface with fill_holes
Image

Gaussian Smoothing

Gaussian Smoothing
Image

Geodesic Paths

Geodesic Paths
Image

Plotting Glyphs (Vectors or PolyData)

Plotting Glyphs (Vectors or PolyData)
Image

Table of Glyphs

Table of Glyphs
Image

Compute Gradients of a Field

Compute Gradients of a Field
Image

Register a Surface with ICP

Register a Surface with ICP
Image

Fast Fourier Transform

Fast Fourier Transform
Image

Fast Fourier Transform with Perlin Noise

Fast Fourier Transform with Perlin Noise
Image

Image Data Representations

Image Data Representations
Image

Integrate Data

Integrate Data
Image

Detailed Interpolating Points

Detailed Interpolating Points
Image

Compare interpolation/sampling methods

Compare interpolation/sampling methods
Image

Marching Cubes

Marching Cubes
Image

Computing Mesh Quality

Computing Mesh Quality
Image

Sample Function: Perlin Noise in 2D

Sample Function: Perlin Noise in 2D
Image

Sample Function: Perlin Noise in 3D

Sample Function: Perlin Noise in 3D
Image

Measure Distance Between Point Clouds

Measure Distance Between Point Clouds
Image

Analyze the Orientation of a Point Cloud

Analyze the Orientation of a Point Cloud
Image

Project to a Plane

Project to a Plane
Image

Ray Tracing

Ray Tracing
Image

Reflect Meshes

Reflect Meshes
Image

Detailed Resampling

Detailed Resampling
Image

Rotations

Rotations
Image

Slicing

Slicing
Image

Streamlines

Streamlines
Image

2D Streamlines

2D Streamlines
Image

Subdivide Cells

Subdivide Cells
Image

Surface Reconstruction

Surface Reconstruction
Image

Surface Smoothing

Surface Smoothing
Image

Using Common Filters

Using Common Filters
Image

Volumetric Analysis

Volumetric Analysis
Image

Voxelize a Surface Mesh

Voxelize a Surface Mesh
Image

Warping by Vectors

Warping by Vectors

Plotting#

These examples show case many of the possibilities for altering how you display spatial data. Explore these examples to learn how to leverage our powerful 3D plotting routines to perform tasks like:

  • Color mapping scalar values with matplotlib colormaps

  • Creating animations as GIFs or movie files

  • Showing the edges and nodes of different mesh types

  • Use sophisticated lighting techniques like smooth shading or Eye Dome Lighting

  • Glyph a vector or scalar field on a mesh (place/orient a mesh on another mesh’s nodes and scale/orient based on data values)

  • Label points in 3D space along side your meshes

  • Creating side-by-side comparisons

  • Making a dataset transparent or using a scalar value to map opacity

  • Adding textures/images draped over a mesh (texture mapping)

  • Rendering a depth image

Image

Anti-Aliasing

Anti-Aliasing
Image

Axes Objects

Axes Objects
Image

Setting Backface Properties

Setting Backface Properties
Image

Background Image

Background Image
Image

Blurring

Blurring
Image

Plotting Bounds

Plotting Bounds
Image

Chart Basics

Chart Basics
Image

Chart Overlays

Chart Overlays
Image

Build a Ball-and-Stick Molecule

Build a Ball-and-Stick Molecule
Image

Clearing a Mesh or the Entire Plot

Clearing a Mesh or the Entire Plot
Image

Color Cycling

Color Cycling
Image

Color Several Lines

Color Several Lines
Image

Colormap Choices

Colormap Choices
Image

Composite Picking

Composite Picking
Image

Depth of Field Plotting

Depth of Field Plotting
Image

Depth Peeling

Depth Peeling
Image

Label based on Distance on Line

Label based on Distance on Line
Image

Measuring distance

Measuring distance
Image

Eye Dome Lighting

Eye Dome Lighting
Image

Picking elements of a mesh

Picking elements of a mesh
Image

Plot Curved Flight Paths on a Globe

Plot Curved Flight Paths on a Globe
Image

Plot with Floors

Plot with Floors
Image

Hide Cells with Ghosting

Hide Cells with Ghosting
Image

Create a GIF Movie

Create a GIF Movie
Image

Plot a 3D Graph Network

Plot a 3D Graph Network
Image

Render a depth image

Render a depth image
Image

Interpolate Before Mapping

Interpolate Before Mapping
Image

Legends and glyphs

Legends and glyphs
Image

Lighting Properties

Lighting Properties
Image

Linked Views in Subplots

Linked Views in Subplots
Image

Lookup Tables

Lookup Tables
Image

Plot a Lorenz Attractor

Plot a Lorenz Attractor
Image

Maximum Intensity Projection

Maximum Intensity Projection
Image

Picking Meshes

Picking Meshes
Image

Create a MP4 Movie

Create a MP4 Movie
Image

Save a Movie Using Glyphs

Save a Movie Using Glyphs
Image

Create a GIF Movie of a Static Object with a Moving Colormap

Create a GIF Movie of a Static Object with a Moving Colormap
Image

Moving Isovalue

Moving Isovalue
Image

Multi-Window Plot

Multi-Window Plot
Image

Plot with Opacity

Plot with Opacity
Image

Orbiting

Orbiting
Image

Physically Based Rendering

Physically Based Rendering
Image

Plot Scalars Over a Circular Arc

Plot Scalars Over a Circular Arc
Image

Plot Over Line

Plot Over Line
Image

Point Cell Scalars

Point Cell Scalars
Image

Highlight Nearest Neighbors in a Point Cloud

Highlight Nearest Neighbors in a Point Cloud
Image

Plotting Point Clouds

Plotting Point Clouds
Image

Label Points

Label Points
Image

Picking points on a mesh

Picking points on a mesh
Image

Point Sprite Shapes

Point Sprite Shapes
Image

Scaled Gaussian Points

Scaled Gaussian Points
Image

Customize Scalar Bars

Customize Scalar Bars
Image

Saving Screenshots

Saving Screenshots
Image

Types of Shading

Types of Shading
Image

Sharing Scalar Bars

Sharing Scalar Bars
Image

Show Edges

Show Edges
Image

Silhouette Highlight

Silhouette Highlight
Image

Orthogonal Slices

Orthogonal Slices
Image

Plot data in spherical coordinates

Plot data in spherical coordinates
Image

Surface Space Ambient Occlusion

Surface Space Ambient Occlusion
Image

Picking a Point on the Surface of a Mesh

Picking a Point on the Surface of a Mesh
Image

Applying Textures

Applying Textures
Image

Control Global and Local Plotting Themes

Control Global and Local Plotting Themes
Image

Topographic Map

Topographic Map
Image

Plot Vector Component

Plot Vector Component
Image

Visible Vertices

Visible Vertices
Image

Volume Rendering

Volume Rendering

Widgets#

PyVista has several widgets that can be added to the rendering scene to control filters like clipping, slicing, and thresholding - specifically there are widgets to control the positions of boxes, planes, and lines or slider bars which can all be highly customized through the use of custom callback functions.

Here we’ll take a look at the various widgets, some helper methods that leverage those widgets to do common tasks, and demonstrate how to leverage the widgets for user defined tasks and processing routines.

Image

Animation

Animation
Image

Box Widget

Box Widget
Image

Checkbox Widget

Checkbox Widget
Image

Clip Volume Widget

Clip Volume Widget
Image

Line Widget

Line Widget
Image

Multiple Slider Widgets

Multiple Slider Widgets
Image

Plane Widget

Plane Widget
Image

Slider Bar Widget

Slider Bar Widget
Image

Sphere Widget

Sphere Widget
Image

Spline Widget

Spline Widget

Lighting#

These examples demonstrate how to take fine-tuned control over lighting conditions in a scene. Explore them to learn how to go beyond the default lighting setup to truly bring out the best of your visualization:

  • Choose between preset lighting systems for plotters

  • Disable lighting on the mesh level

  • Learn about the different light types

  • Customize the shape of positional lights

  • Use actors to visualize the beams of spotlights

Image

Attenuation

Attenuation
Image

Beam Shape

Beam Shape
Image

Light Actors

Light Actors
Image

Light Types

Light Types
Image

Disabling Mesh Lighting

Disabling Mesh Lighting
Image

Plotter Lighting Systems

Plotter Lighting Systems
Image

Shadows

Shadows

Common#

The following are a collection of examples addressing common tasks and frequently asked questions when working with PyVista. These examples, while possibly complex, focus on single-purpose solutions to help users understand specific functionality.

Feel free to contribute examples or explore the FAQ-like structure, and check out our GitHub Discussions for more context.

Image

Export Mesh Data to a DataFrame

Export Mesh Data to a DataFrame
Image

Project points to a plane and Tessellate

Project points to a plane and Tessellate

Advanced#

Include here are few longer, more advanced examples from our users and developers.

Image

Adding a New Gallery Example

Adding a New Gallery Example
Image

Visualize Anatomical Groups

Visualize Anatomical Groups
Image

Compare Field Across Mesh Regions

Compare Field Across Mesh Regions
Image

Plot Atomic Orbitals

Plot Atomic Orbitals
Image

Customize Trame toolbar

Customize Trame toolbar
Image

Extending PyVista

Extending PyVista
Image

Visualize Hertzian Contact Stress

Visualize Hertzian Contact Stress
Image

Plot a Gyroid Surface

Plot a Gyroid Surface
Image

Plot a Magnetic Field

Plot a Magnetic Field
Image

Mesh Validation

Mesh Validation
Image

Plot OpenFOAM data

Plot OpenFOAM data
Image

Electronics Cooling CFD

Electronics Cooling CFD
Image

Plot CFD Data

Plot CFD Data
Image

3D Earth and Celestial Bodies

3D Earth and Celestial Bodies
Image

Plotting with VTK Algorithms

Plotting with VTK Algorithms
Image

Visualize Modal Analysis of a Pump Bracket

Visualize Modal Analysis of a Pump Bracket
Image

Visualize the Moeller-Trumbore Algorithm

Visualize the Moeller-Trumbore Algorithm
Image

Turning the sphere inside out

Turning the sphere inside out
Image

Display Eigenmodes of Vibration

Display Eigenmodes of Vibration

Gallery generated by Sphinx-Gallery