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.

Creating an Explicit Structured Grid

Creating an Explicit Structured Grid

Geometric Objects

Geometric Objects

Create a Kochanek Spline

Create a Kochanek Spline

Parametric Geometric Objects

Parametric Geometric Objects

Pixel Art of ALIEN MONSTERS

Pixel Art of ALIEN MONSTERS

Platonic Solids

Platonic Solids

Create Point Cloud

Create Point Cloud

Create a PointSet

Create a PointSet

Create PolyData

Create PolyData

Triangle Strips

Triangle Strips

Unstructured Grid with Polyhedra

Unstructured Grid with Polyhedra

Creating a Spline

Creating a Spline

Creating a Structured Surface

Creating a Structured Surface

Drape 2D Surface From Line

Drape 2D Surface From Line

Create Triangulated Surface

Create Triangulated Surface

Plot Truss-like FEA Solution with Cylinders

Plot Truss-like FEA Solution with Cylinders

Creating a Uniform Grid

Creating a Uniform Grid

Creating an Unstructured Grid

Creating an Unstructured Grid

Linear Cells

Linear Cells

Working with glTF Files

Working with glTF Files

Working with VRML Files

Working with VRML Files

Read FEniCS/Dolfin Meshes

Read FEniCS/Dolfin Meshes

Load and Plot from a File

Load and Plot from a File

Read Image Files

Read Image Files

Parallel Files

Parallel Files

Load data using a Reader

Load data using a Reader

Terrain Following Mesh

Terrain Following Mesh

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

Boolean Operations

Boolean Operations

Extract Cell Centers

Extract Cell Centers

Clipping with a Surface

Clipping with a Surface

Clipping with Planes & Boxes

Clipping with Planes & Boxes

Collision

Collision

Computing Surface Normals

Computing Surface Normals

Volumetric Analysis

Volumetric Analysis

Connectivity

Connectivity

Contouring

Contouring

Decimation

Decimation

Distance Between Two Surfaces

Distance Between Two Surfaces

Extract Cells Inside Surface

Extract Cells Inside Surface

Extract Edges

Extract Edges

Extract Surface

Extract Surface

Extrude Rotation

Extrude Rotation

Extrude Trim

Extrude Trim

Marching Cubes

Marching Cubes

Gaussian Smoothing

Gaussian Smoothing

Geodesic Paths

Geodesic Paths

Plotting Glyphs (Vectors or PolyData)

Plotting Glyphs (Vectors or PolyData)

Table of Glyphs

Table of Glyphs

Compute Gradients of a Field

Compute Gradients of a Field

Fast Fourier Transform with Perlin Noise

Fast Fourier Transform with Perlin Noise

Fast Fourier Transform

Fast Fourier Transform

Integrate Data

Integrate Data

Interpolating

Interpolating

Computing Mesh Quality

Computing Mesh Quality

Ray Tracing

Ray Tracing

Project to a Plane

Project to a Plane

Reflect Meshes

Reflect Meshes

Resampling

Resampling

Rotations

Rotations

Sample Function: Perlin Noise in 2D

Sample Function: Perlin Noise in 2D

Sample Function: Perlin Noise in 3D

Sample Function: Perlin Noise in 3D

Slicing

Slicing

Streamlines

Streamlines

2D Streamlines

2D Streamlines

Subdivide Cells

Subdivide Cells

Surface Smoothing

Surface Smoothing

Surface Reconstruction

Surface Reconstruction

Using Common Filters

Using Common Filters

Voxelize a Surface Mesh

Voxelize a Surface Mesh

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

Anti-Aliasing

Anti-Aliasing

Setting Backface Properties

Setting Backface Properties

Background Image

Background Image

Blurring

Blurring

Plotting Bounds

Plotting Bounds

Chart Basics

Chart Basics

Chart Overlays

Chart Overlays

Clearing a Mesh or the Entire Plot

Clearing a Mesh or the Entire Plot

Colormap Choices

Colormap Choices

Color Cycling

Color Cycling

Composite Picking

Composite Picking

Depth Peeling

Depth Peeling

Depth of Field Plotting

Depth of Field Plotting

Label based on Distance on Line

Label based on Distance on Line

Measuring distance

Measuring distance

Show Edges

Show Edges

Eye Dome Lighting

Eye Dome Lighting

Picking elements of a mesh

Picking elements of a mesh

Plot with Floors

Plot with Floors

Hide Cells with Ghosting

Hide Cells with Ghosting

Create a GIF Movie

Create a GIF Movie

Render a depth image

Render a depth image

Interpolate Before Mapping

Interpolate Before Mapping

Moving Isovalue

Moving Isovalue

Label Points

Label Points

Lighting Properties

Lighting Properties

Linked Views in Subplots

Linked Views in Subplots

Lookup Tables

Lookup Tables

Picking Meshes

Picking Meshes

Create a MP4 Movie

Create a MP4 Movie

Save a Movie Using Glyphs

Save a Movie Using Glyphs

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

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

Multi-Window Plot

Multi-Window Plot

Plot with Opacity

Plot with Opacity

Orbiting

Orbiting

Orthogonal Slices

Orthogonal Slices

Physically Based Rendering

Physically Based Rendering

Plot Scalars Over a Circular Arc

Plot Scalars Over a Circular Arc

Plot Over Line

Plot Over Line

Point Cell Scalars

Point Cell Scalars

Plotting Point Clouds

Plotting Point Clouds

Picking points on a mesh

Picking points on a mesh

Scaled Gaussian Points

Scaled Gaussian Points

Customize Scalar Bars

Customize Scalar Bars

Saving Screenshots

Saving Screenshots

Types of Shading

Types of Shading

Silhouette Highlight

Silhouette Highlight

Plot data in spherical coordinates

Plot data in spherical coordinates

Surface Space Ambient Occlusion

Surface Space Ambient Occlusion

Picking a Point on the Surface of a Mesh

Picking a Point on the Surface of a Mesh

Applying Textures

Applying Textures

Control Global and Local Plotting Themes

Control Global and Local Plotting Themes

Topographic Map

Topographic Map

Plot Vector Component

Plot Vector Component

Visible Vertices

Visible Vertices

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.

Animation

Animation

Box Widget

Box Widget

Checkbox Widget

Checkbox Widget

Clip Volume Widget

Clip Volume Widget

Line Widget

Line Widget

Multiple Slider Widgets

Multiple Slider Widgets

Plane Widget

Plane Widget

Slider Bar Widget

Slider Bar Widget

Sphere Widget

Sphere Widget

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

Light Actors

Light Actors

Attenuation

Attenuation

Beam Shape

Beam Shape

Light Types

Light Types

Disabling Mesh Lighting

Disabling Mesh Lighting

Plotter Lighting Systems

Plotter Lighting Systems

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.

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.

Adding a New Gallery Example

Adding a New Gallery Example

Compare Field Across Mesh Regions

Compare Field Across Mesh Regions

Plot Atomic Orbitals

Plot Atomic Orbitals

Customize Trame toolbar

Customize Trame toolbar

Extending PyVista

Extending PyVista

Visualize Hertzian Contact Stress

Visualize Hertzian Contact Stress

Plot a Magnetic Field

Plot a Magnetic Field

Electronics Cooling CFD

Electronics Cooling CFD

Plot OpenFOAM data

Plot OpenFOAM data

Plot CFD Data

Plot CFD Data

Plot Open Street Map Data

Plot Open Street Map Data

3D Earth and Celestial Bodies

3D Earth and Celestial Bodies

Plotting with VTK Algorithms

Plotting with VTK Algorithms

Visualize Modal Analysis of a Pump Bracket

Visualize Modal Analysis of a Pump Bracket

Visualize the Moeller–Trumbore Algorithm

Visualize the Moeller–Trumbore Algorithm

Ray Tracing

Ray Tracing

Turning the sphere inside out

Turning the sphere inside out

Display Eigenmodes of Vibration

Display Eigenmodes of Vibration

Gallery generated by Sphinx-Gallery