Logo
0.28.dev0
  • About
  • Why PyVista?
  • Authors & Citation

Getting Started

  • Installation
  • What is a Mesh?
  • Basic API Usage
  • Examples Gallery
    • Mesh Creation
      • Creating an Explicit Structured Grid
      • Geometric Objects
      • Parametric Geometric Objects
      • Create Point Cloud
      • Create PolyData
      • Creating a Spline
      • Creating a Structured Surface
      • Drape 2D Surface From Line
      • Create Triangulated Surface
      • Creating a Uniform Grid
      • Creating an Unstructured Grid
      • Read FEniCS/Dolfin Meshes
      • Load and Plot from a File
      • Read Image Files
      • Parallel Files
      • Terrain Following Mesh
      • Wrapping Other Objects
    • Filtering
      • Boolean Operations
      • Extract Cell Centers
      • Clipping with a Surface
      • Clipping with Planes & Boxes
      • Computing Surface Normals
      • Volumetric Analysis
      • Connectivity
      • Contouring
      • Decimation
      • Distance Between Two Surfaces
      • Extract Cells Inside Surface
      • Extract Edges
      • Extract Surface
      • Create a quadratic cell and extract its surface
      • Nonlinear Surface Subdivision
      • Extrude Rotation
      • Plot the extruded line
      • Gaussian Smoothing
      • Geodesic Paths
      • Plotting Glyphs (Vectors or PolyData)
      • Table of Glyphs
      • Compute Gradients of a Field
      • Interpolating
      • Computing Mesh Quality
      • Ray Tracing
      • Project to a Plane
      • Reflect Meshes
      • Resampling
      • Slicing
      • Streamlines
      • Subdivide Cells
      • Surface Smoothing
      • Using Common Filters
      • Voxelize a Surface Mesh
      • Warping by Vectors
    • Plotting
      • Background Image
      • Clearing a Mesh or the Entire Plot
      • Colormap Choices
      • Depth Peeling
      • Show Edges
      • Eye Dome Lighting
      • Plot with Floors
      • Hide Cells with Ghosting
      • Create a GIF Movie
      • Render a depth image
      • Interpolate Before Mapping
      • Moving Isovalue
      • Label Points
      • Lighting Properties
      • Linked Views in Subplots
      • Create a MP4 Movie
      • Multi-Window Plot
      • Plot with Opacity
      • Orbiting
      • Orthogonal Slices
      • Plot Over Line
      • Customize Scalar Bars
      • Saving Screenshots
      • Types of Shading
      • Silhouette Highlight
      • Plot data in spherical coordinates
      • Applying Textures
      • Change the Theme
      • Topographic Map
      • Volume Rendering
    • Widgets
      • Box Widget
      • Checkbox Widget
      • Line Widget
      • Multiple Slider Widgets
      • Plane Widget
      • Slider Bar Widget
      • Sphere Widget
      • Spline Widget
    • Lighting
      • Light Actors
      • Attenuation
      • Beam Shape
      • Light Types
      • Disabling Mesh Lighting
      • Plotter Lighting Systems
    • Advanced
      • Compare Field Across Mesh Regions
      • Ray Tracing
      • Displaying eigenmodes of vibration using warp_by_vector
  • External Examples
  • Optional Features

API Reference

  • Core API
  • Plotting
  • Utilities

Extras

  • Building VTK
  • PyVista within a Docker Container
  • Contributing
  • Freezing pyvista with pyinstaller
  • Flask Application

Getting Connected

  • Slack Community
  • Support
  • Source Code
  • Contributing
  • The Paper
We use ads to cover the cost of maintenance for this site and fund beverages for the occasional hackathon (🍺 on us!)
PyVista
  • »
  • Examples Gallery

Examples GalleryΒΆ

Here is a gallery of all the quick 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ΒΆ

Parametric Geometric Objects

Parametric Geometric ObjectsΒΆ

Create Point Cloud

Create Point CloudΒΆ

Create PolyData

Create PolyDataΒΆ

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ΒΆ

Creating a Uniform Grid

Creating a Uniform GridΒΆ

Creating an Unstructured Grid

Creating an Unstructured GridΒΆ

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ΒΆ

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ΒΆ

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ΒΆ

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ΒΆ

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ΒΆ

Slicing

SlicingΒΆ

Streamlines

StreamlinesΒΆ

Subdivide Cells

Subdivide CellsΒΆ

Surface Smoothing

Surface SmoothingΒΆ

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 anther 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

Background Image

Background ImageΒΆ

Clearing a Mesh or the Entire Plot

Clearing a Mesh or the Entire PlotΒΆ

Colormap Choices

Colormap ChoicesΒΆ

Depth Peeling

Depth PeelingΒΆ

Show Edges

Show EdgesΒΆ

Eye Dome Lighting

Eye Dome LightingΒΆ

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ΒΆ

Create a MP4 Movie

Create a MP4 MovieΒΆ

Multi-Window Plot

Multi-Window PlotΒΆ

Plot with Opacity

Plot with OpacityΒΆ

Orbiting

OrbitingΒΆ

Orthogonal Slices

Orthogonal SlicesΒΆ

Plot Over Line

Plot Over LineΒΆ

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ΒΆ

Applying Textures

Applying TexturesΒΆ

Change the Theme

Change the ThemeΒΆ

Topographic Map

Topographic MapΒΆ

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.

Box Widget

Box WidgetΒΆ

Checkbox Widget

Checkbox 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ΒΆ

AdvancedΒΆ

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

Compare Field Across Mesh Regions

Compare Field Across Mesh RegionsΒΆ

Ray Tracing

Ray TracingΒΆ

Displaying eigenmodes of vibration using ``warp_by_vector``

Displaying eigenmodes of vibration using warp_by_vectorΒΆ

Gallery generated by Sphinx-Gallery

Next Previous

© Copyright 2017-2021, The PyVista Developers.

Built with Sphinx using a theme provided by Read the Docs.