pyvista.Plotter#
- class Plotter(*args, **kwargs)[source]#
Plotting object to display vtk meshes or numpy arrays.
- Parameters:
- off_screenbool,
optional Renders off screen when
True. Useful for automated screenshots.- notebookbool,
optional When
True, the resulting plot is placed inline a jupyter notebook. Assumes a jupyter console is active. Automatically enablesoff_screen.- shapesequence[
int],optional Number of sub-render windows inside of the main window. Specify two across with
shape=(2, 1)and a two by two grid withshape=(2, 2). By default there is only one render window. Can also accept a string descriptor as shape. E.g.:shape="3|1"means 3 plots on the left and 1 on the right,shape="4/2"means 4 plots on top and 2 at the bottom.
- borderbool,
optional Draw a border around each render window.
- border_color
ColorLike, default: “k” Either a string, rgb list, or hex color string. For example:
color='white'color='w'color=[1.0, 1.0, 1.0]color='#FFFFFF'
- window_sizesequence[
int],optional Window size in pixels. Defaults to
[1024, 768], unless set differently in the relevant theme’swindow_sizeproperty.- line_smoothingbool, default:
False If
True, enable line smoothing.- polygon_smoothingbool, default:
False If
True, enable polygon smoothing.- lighting
str, default: ‘light kit” Lighting to set up for the plotter. Accepted options:
'light kit': a vtk Light Kit composed of 5 lights.'three lights': illumination using 3 lights.'none': no light sources at instantiation.
The default is a
'light kit'(to be precise, 5 separate lights that act like a Light Kit).- theme
pyvista.plotting.themes.Theme,optional Plot-specific theme.
- image_scale
int,optional Scale factor when saving screenshots. Image sizes will be the
window_sizemultiplied by this scale factor.
- off_screenbool,
Examples
>>> import pyvista as pv >>> mesh = pv.Cube() >>> another_mesh = pv.Sphere() >>> pl = pv.Plotter() >>> actor = pl.add_mesh(mesh, color='red', style='wireframe', line_width=4) >>> actor = pl.add_mesh(another_mesh, color='blue') >>> pl.show()
Methods#
|
Add an actor to render window. |
|
Add a 3D affine transform widget. |
|
Add arrows to the plotter. |
|
Add an interactive axes widget in the bottom left corner. |
|
Add axes actor at origin. |
|
Add a background image to a plot. |
Add blurring. |
|
|
Add an unlabeled and unticked box at the boundaries of plot. |
|
Add an interactive color box axes widget in the bottom left corner. |
|
Add a box widget to the scene. |
Add a camera3d widget allow to move the camera. |
|
Add a camera orientation widget to the active renderer. |
|
|
Add a chart to this renderer. |
|
Add a checkbox button widget to the scene. |
|
Add a composite dataset to the plotter. |
|
Add a cursor of a PyVista or VTK dataset to the scene. |
|
Show a floor mesh. |
|
Add a function to callback when the given key is pressed. |
|
Add a legend to render window. |
|
Annotate the render window with scale and distance information. |
|
Add a Light to the scene. |
|
Add a line widget to the scene. |
|
Add lines to the plotting object. |
|
Add a logo widget to the top of the viewport. |
|
Interactively measure distance with a distance widget. |
|
Add any PyVista/VTK mesh or dataset that PyVista can wrap to the scene. |
|
Clip a mesh using a box widget. |
|
Clip a mesh using a plane widget. |
|
Create a contour of a mesh with a slider. |
|
Slice a mesh using a plane widget. |
|
Slice a mesh with three interactive planes. |
|
Slice a mesh with a spline widget. |
|
Apply a threshold on a mesh with a slider. |
Add a geographic north arrow to the scene. |
|
|
Add a method to be called post-render. |
|
Use the given actor in an orientation marker widget. |
|
Add a plane widget to the scene. |
|
Create a point actor with one label from list labels assigned to each point. |
|
Label the points from a dataset with the values of their scalars. |
|
Add points to a mesh. |
|
Add a radio button widget to the scene. |
|
Add ruler. |
|
Create scalar bar using the ranges as set by the last input mesh. |
|
Add a silhouette of a PyVista or VTK dataset to the scene. |
|
Add a slider bar widget. |
|
Add one or many sphere widgets to a scene. |
|
Create and add a spline widget to the scene. |
|
Add text to plot object in the top left corner by default. |
|
Add a text slider bar widget. |
|
Add a function to callback as timer event. |
|
Add text to the top center of the plot. |
|
Add a volume, rendered using a smart mapper by default. |
|
Clip a volume using a plane widget. |
Clear plot by removing all actors and properties. |
|
Clear actors from all renderers. |
|
Remove all of the box widgets. |
|
Remove all of the button widgets. |
|
Remove all of the camera3d widgets. |
|
Remove all of the camera widgets. |
|
|
Remove the callbacks associated to the key. |
Remove all of the line widgets. |
|
Remove all of the logo widgets. |
|
Remove all of the measurement widgets. |
|
Clear all callback methods previously registered with |
|
Remove all of the plane widgets. |
|
Remove all of the radio button widgets. |
|
Remove all of the slider widgets. |
|
Remove all of the sphere widgets. |
|
Remove all of the spline widgets. |
|
Close the render window. |
|
|
Return the bounds of actors present in the renderer. |
Clean the plotter of the memory. |
|
Disable this renderer's camera from being interactive. |
|
Please use |
|
|
Disable anti-aliasing. |
Disable depth of field plotting. |
|
Disable depth peeling. |
|
Disable eye dome lighting (EDL). |
|
Disable hidden line removal. |
|
Reset the camera to use perspective projection. |
|
Disable any active picking and remove observers. |
|
Disable shadows. |
|
Disable surface space ambient occlusion (SSAO). |
|
Disable anaglyph stereo rendering. |
|
Enable this renderer's camera to be interactive. |
|
Set the interactive style to 2D. |
|
|
Enable 3-lights illumination. |
|
Enable anti-aliasing. |
|
Enable composite block picking. |
|
Enable picking of cells with a rectangle selection tool. |
Set the interactive style to a custom style based on Trackball Camera. |
|
Enable depth of field plotting. |
|
|
Enable depth peeling to improve rendering of translucent geometry. |
|
Select individual elements on a mesh. |
Enable eye dome lighting (EDL). |
|
|
Set the camera to track right click positions. |
|
Enable picking at geodesic paths. |
Enable hidden line removal. |
|
|
Enable horizon picking. |
Set the interactive style to Image. |
|
Set the interactive style to Joystick Actor. |
|
Set the interactive style to Joystick Camera. |
|
|
Enable the default light-kit lighting. |
|
Enable picking of a mesh. |
Enable parallel projection. |
|
|
Enable picking at paths. |
|
Enable picking at points under the cursor. |
|
Enable rectangle based picking at cells. |
Enable rectangle based cell picking through the scene. |
|
Enable rectangle based cell picking on visible surfaces. |
|
Set the interactive style to Rubber Band 2D. |
|
Set the interactive style to Rubber Band Picking. |
|
Enable shadows. |
|
|
Enable surface space ambient occlusion (SSAO). |
Enable anaglyph stereo rendering. |
|
Enable picking of a point on the surface of a mesh. |
|
|
Set the interactive style to Terrain. |
Set the interactive style to Trackball Actor. |
|
Set the interactive style to Trackball Camera. |
|
Set the interactive style to Rubber Band Zoom. |
|
|
Export the current rendering scene as a glTF file. |
|
Export this plotter as an interactive scene to a HTML file. |
|
Export scene to OBJ format. |
|
Export the current rendering scene as a VRML file. |
|
Export this plotter as a VTK.js OfflineLocalView file. |
|
Move the current camera's focal point to a position point. |
|
Focus on last stored mouse position. |
|
Generate an orbital path around the data scene. |
|
Return the default focal points and viewup. |
|
Return a depth image representing current render window. |
Get the pick position or area. |
|
Hide the axes orientation widget. |
|
Hide the axes orientation widget in all renderers. |
|
|
Set the image scale in an isolated context. |
|
Import a 3DS file into the plotter. |
|
Import a glTF file into the plotter. |
|
Import from .obj wavefront files. |
|
Import a VRML file into the plotter. |
Increment point size and line width of all actors. |
|
Reset the camera to a default isometric view. |
|
Set the current interactive render window to isometric view. |
|
|
Listen for key press event. |
|
Register the event for a left button down click. |
|
Link the views' cameras. |
|
Open a gif file. |
|
Establish a connection to the ffmpeg writer. |
|
Orbit on the given path focusing on the focus point. |
Get corresponding click location in the 3D plot. |
|
Get corresponding mouse location in the 3D plot. |
|
|
Remove an actor from the Renderer. |
|
Remove all lights from the scene. |
Remove the background image at the current renderer. |
|
Remove a single blurring pass. |
|
|
Remove bounding box. |
Remove bounds axes. |
|
|
Remove a chart from this renderer. |
Remove the environment texture. |
|
|
Remove all floor actors. |
|
Remove the legend actor. |
|
Remove a scalar bar. |
Render the main window. |
|
|
Reset the camera of the active render window. |
Reset camera clipping planes. |
|
Reset all of the key press events to their defaults. |
|
|
Save a screenshot of the rendering window as a graphic file. |
|
Take screenshot at current camera position. |
|
Set the background color. |
|
Set or toggle interaction with charts for the active renderer. |
|
Set or reset the color cycler. |
|
Set the environment texture used for image based lighting. |
|
Set focus to a point. |
|
Set camera position to a point. |
|
Scale all the actors in the scene. |
|
Set camera viewup vector. |
|
Display the plotting window. |
Show the axes orientation widget. |
|
Show the axes orientation widget in all renderers. |
|
|
Add bounds axes. |
|
Show grid lines and bounds axes labels. |
|
Store click position in viewport coordinates. |
|
Store mouse position. |
|
Set the active subplot. |
|
Keep track of the click position. |
Keep track of the mouse position. |
|
|
Unlink the views' cameras. |
|
Stop tracking the click position. |
Stop tracking the mouse position. |
|
|
Update window, redraw, process messages query. |
Update the bounds axes of the render window. |
|
|
Update the value range of the active or named scalar bar. |
|
Update scalars of an object in the plotter. |
|
Reset the camera to a default isometric view. |
|
Point the camera in the direction of the given vector. |
|
View the XY plane. |
|
View the XZ plane. |
|
View the YX plane. |
|
View the YZ plane. |
|
View the ZX plane. |
|
View the ZY plane. |
|
Return the subplot coordinates of a given actor. |
|
Set the render window size in an isolated context. |
Write a single frame to the movie file. |
|
|
Zoom of the camera and render. |
Attributes#
Return the actors of the active renderer. |
|
Return the background color of the active render window. |
|
Return the bounds of all VISIBLE actors present in the active rendering window. |
|
Return the size of each axis of the object's bounding box. |
|
Return the active camera of the active renderer. |
|
Set or return the camera position of the active render window. |
|
Return or set if the camera of the active renderer has been set. |
|
Return the center of the active renderer. |
|
Return an image array of current render window. |
|
Return a depth image representing current render window. |
|
Get or set the scale factor when saving a screenshot. |
|
Legend actor. |
|
Return the length of the diagonal of the bounding box of the scene. |
|
Return plotter meshes. |
|
Return or set parallel projection state of active render window. |
|
Return or set parallel scale of active render window. |
|
Return or set the pickable actors. |
|
Return the picked mesh. |
|
Return the picked block index. |
|
Return the cell-picked object. |
|
Return the cell-picked object. |
|
Return the picked mesh. |
|
Return the picked point. |
|
Access the vtkRenderWindow attached to this plotter. |
|
Return the active renderer. |
|
First scalar bar (kept for backwards compatibility). |
|
Scalar bars. |
|
Return the scaling of the active renderer. |
|
Return the shape of the plotter. |
|
Get or set whether to suppress render calls. |
|
Return or set the theme used for this plotter. |
|
Return the render window size in |