Plotting#

Plotting Functions#

These functions provide a simplified interface to the plotting classes below.

close_all()

Close all open/active plotters and clean up memory.

plot(var_item[, off_screen, full_screen, ...])

Plot a PyVista, NumPy, or VTK object.

plot_arrows(cent, direction, **kwargs)

Plot arrows as vectors.

plot_compare(datasets, *[, labels, ...])

Plot a grid comparison of any number of data objects.

plot_compare_four(data_a, data_b, data_c, data_d)

Plot a 2 by 2 comparison of data objects.

Plotter#

Cameras and lights are documented on their own pages: Cameras and Lights.

Plotter(*args, **kwargs)

Plotting object to display VTK meshes or NumPy arrays.

CameraPosition(*args, **kwargs)

Container to hold camera location attributes.

Renderer(*args, **kwargs)

Renderer class.

RenderWindowInteractor(*args, **kwargs)

Wrap vtkRenderWindowInteractor.

Timer(*args, **kwargs)

Timer class.

See also

Multi-Window Plot

Lay out several renderers in one window.

Saving Screenshots

Save screenshots from a plotter.

Create a MP4 Movie

Write frames to a movie.

Actors and Mappers#

Actor(*args, **kwargs)

Wrap vtkActor.

DataSetMapper(*args, **kwargs)

Wrap vtkDataSetMapper.

Follower(*args, **kwargs)

Wrap vtkFollower.

plotting.mapper.PointGaussianMapper(*args, ...)

Wrap vtkPointGaussianMapper.

Prop3D(*args, **kwargs)

Prop3D wrapper for vtkProp3D.

Property(*args, **kwargs)

Wrap vtkProperty and expose it pythonically.

See also

Setting Backface Properties

Set properties for the back faces of an actor.

Lighting Properties

Control how an actor’s surface reflects light.

Volume Rendering#

See also

Volume Rendering

Render a volume with the different mappers.

Plot With Opacity

Build an opacity transfer function.

Text and Labels#

CornerAnnotation(*args, **kwargs)

Text annotation in four corners.

Label(*args, **kwargs)

2D label actor with a 3D position coordinate.

Text(*args, **kwargs)

Define text by default theme.

TextProperty(*args, **kwargs)

Define text's property.

See also

Label Points

Label points in a scene.

Axes and Orientation#

Axes(*args, **kwargs)

PyVista wrapper for the VTK Axes class.

AxesActor(*args, **kwargs)

Axes actor wrapper for vtkAxesActor.

AxesAssembly(*args, **kwargs)

Assembly of arrow-style axes parts.

AxesAssemblySymmetric(*args, **kwargs)

Symmetric assembly of arrow-style axes parts.

CubeAxesActor(*args, **kwargs)

Wrap vtkCubeAxesActor.

PlanesAssembly(*args, **kwargs)

Assembly of orthogonal planes.

create_axes_marker([label_color, x_color, ...])

Create an axis actor.

create_axes_orientation_box([line_width, ...])

Create a Box axes orientation widget with labels.

See also

Axes Objects

Compare the axes objects and add them to a scene.

Lookup Tables#

Colors, colormaps, and the Color class are documented under Colors.

LookupTable(*args, **kwargs)

Scalar to RGBA mapping table.

See also

Lookup Tables

Build a lookup table from a colormap or a list of colors.

Enumerations#

plotting.opts.ElementType(*values)

Types of elemental geometries.

plotting.opts.InterpolationType(*values)

Lighting interpolation types.

plotting.opts.PointSpriteShape(*values)

Point sprite shape options for fragment shader rendering.

plotting.opts.RepresentationType(*values)

Types of representations the models can have.

plotting.opts.ShaderType(*values)

Shader types for GLSL shader replacements.

Composite Plotting#

These classes are used when plotting pyvista.MultiBlock datasets.

BlockAttributes(*args, **kwargs)

Block attributes used to set the attributes of a block.

CompositeAttributes(*args, **kwargs)

Block attributes.

CompositePolyDataMapper(*args, **kwargs)

Composite PolyData mapper.

Charts API#

Charts API reference. These dedicated classes can be used to embed charts in plotting windows.

Widget API#

Every interactive widget on the plotter (box, plane, line, slider, sphere, spline, button, radio button, measurement, logo, camera, camera3d) lives on the WidgetComponent plotter component, accessible as plotter.widgets. The top-level plotter exposes add_*_widget and clear_*_widgets methods as forwarding shims; both surfaces produce identical results. For additional details, see the Widgets examples.

plotting.widgets.AffineWidget3D(*args, **kwargs)

3D affine transform widget.

plotting.widgets.WidgetComponent(*args, **kwargs)

Plotter widget component.

Picking API#

Picking lives on the PickingComponent plotter component, accessible as plotter.picking. The top-level plotter exposes enable_*_picking, disable_picking, and picked_* properties as forwarding shims.

plotting.picking.PickingComponent(*args, ...)

Plotter picking component.

Interactor Style API#

An interactor style sets mouse and key bindings to interact with the plot. Most often methods like pyvista.Plotter.enable_trackball_style() would be used, but this API can be used as a starting point for customizing the interaction styles.

plotting.render_window_interactor.InteractorStyleCaptureMixin(...)

A mixin for subclasses of vtkInteractorStyle with capturing ability.

plotting.render_window_interactor.InteractorStyleImage(...)

Image interactor style.

plotting.render_window_interactor.InteractorStyleJoystickActor(...)

Joystick actor interactor style.

plotting.render_window_interactor.InteractorStyleJoystickCamera(...)

Joystick camera interactor style.

plotting.render_window_interactor.InteractorStyleRubberBand2D(...)

Rubber band 2D interactor style.

plotting.render_window_interactor.InteractorStyleRubberBandPick(...)

Rubber band pick interactor style.

plotting.render_window_interactor.InteractorStyleTerrain(...)

Terrain interactor style.

plotting.render_window_interactor.InteractorStyleTrackballActor(...)

Trackball actor interactor style.

plotting.render_window_interactor.InteractorStyleTrackballCamera(...)

Trackball camera interactor style.

plotting.render_window_interactor.InteractorStyleZoom(...)

Rubber band zoom interactor style.

VTK Algorithm Utilities#

These functions create VTK algorithm pipeline nodes for use with PyVista’s pipeline-based rendering. They are useful for advanced users who need fine-grained control over the VTK pipeline.

plotting.utilities.active_scalars_algorithm(...)

Add a filter that sets the active scalars.

plotting.utilities.add_ids_algorithm(inp[, ...])

Add a filter that adds point and/or cell IDs.

plotting.utilities.algorithm_to_mesh_handler(...)

Handle vtkAlgorithm where mesh objects are expected.

plotting.utilities.callback_algorithm(inp, ...)

Add a filter that delegates to a user-supplied callable.

plotting.utilities.cell_data_to_point_data_algorithm(inp)

Add a filter that converts cell data to point data.

plotting.utilities.crinkle_algorithm(clip, ...)

Add a filter that crinkles a clip.

plotting.utilities.decimation_algorithm(inp, ...)

Decimate the input data to the target reduction.

plotting.utilities.extract_surface_algorithm(inp)

Add vtkDataSetSurfaceFilter to pipeline.

plotting.utilities.outline_algorithm(inp[, ...])

Add vtkOutlineFilter to pipeline.

plotting.utilities.point_data_to_cell_data_algorithm(inp)

Add a filter that converts point data to cell data.

plotting.utilities.pointset_to_polydata_algorithm(inp)

Add a filter that casts PointSet to PolyData.

plotting.utilities.set_algorithm_input(alg, inp)

Set the input to a vtkAlgorithm.

plotting.utilities.smooth_shading_algorithm(inp)

Add a filter that computes point normals for smooth shading.

plotting.utilities.source_algorithm(...)

Create a source algorithm that generates data from a callable.

plotting.utilities.triangulate_algorithm(inp)

Triangulate the input data.

Jupyter Backends#

The backend is selected with set_jupyter_backend(), and third-party packages can register additional backends. See Jupyter Notebook Plotting for plotting in a notebook.

JupyterBackendRegistration(name, handler, source)

Describe one registered custom Jupyter backend.

register_jupyter_backend(name, handler, *[, ...])

Register a custom Jupyter backend handler.

registered_jupyter_backends()

Return every custom Jupyter backend currently registered.

set_jupyter_backend(backend[, name])

Set the plotting backend for a jupyter notebook.

Shared Base Classes#

These classes are not used directly. They are documented because they define members that several of the classes above share, so that each of those members is documented once, here, and linked from every class that inherits it.

plotting.mapper._BaseDataSetMapper(*args, ...)

Base wrapper for vtkDataSetMapper.

plotting.mapper._BaseMapper(*args, **kwargs)

Base Mapper with methods common to other mappers.

plotting.mapper._BaseVolumeMapper(*args, ...)

Volume mapper class to override methods and attributes for to volume mappers.

core.utilities.misc._NameMixin()

Add a 'name' property to a class.

plotting.prop3d._Prop3DMixin()

Add 3D transformations to props which do not inherit from pyvista.Prop3D.

plotting.axes_assembly._XYZAssembly(*args, ...)

Base class for assemblies of x-y-z actors with labels.