pyvista.Plotter

Contents

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 enables off_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 with shape=(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_colorColorLike, 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’s window_size property.

line_smoothingbool, default: False

If True, enable line smoothing.

polygon_smoothingbool, default: False

If True, enable polygon smoothing.

lightingstr, 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).

themepyvista.plotting.themes.Theme, optional

Plot-specific theme.

image_scaleint, optional

Scale factor when saving screenshots. Image sizes will be the window_size multiplied by this scale factor.

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()
../../../_images/pyvista-Plotter-1_00_00.png

Methods

Plotter.add_actor(actor[, reset_camera, ...])

Add an actor to render window.

Plotter.add_affine_transform_widget(actor[, ...])

Add a 3D affine transform widget.

Plotter.add_arrows(cent, direction[, mag])

Add arrows to the plotter.

Plotter.add_axes([interactive, line_width, ...])

Add an interactive axes widget in the bottom left corner.

Plotter.add_axes_at_origin([x_color, ...])

Add axes actor at origin.

Plotter.add_background_image(image_path[, ...])

Add a background image to a plot.

Plotter.add_blurring()

Add blurring.

Plotter.add_bounding_box([color, ...])

Add an unlabeled and unticked box at the boundaries of plot.

Plotter.add_box_axes(*[, interactive, ...])

Add an interactive color box axes widget in the bottom left corner.

Plotter.add_box_widget(callback[, bounds, ...])

Add a box widget to the scene.

Plotter.add_camera3d_widget()

Add a camera3d widget allow to move the camera.

Plotter.add_camera_orientation_widget([...])

Add a camera orientation widget to the active renderer.

Plotter.add_chart(chart, *charts)

Add a chart to this renderer.

Plotter.add_checkbox_button_widget(callback)

Add a checkbox button widget to the scene.

Plotter.add_composite(dataset[, color, ...])

Add a composite dataset to the plotter.

Plotter.add_cursor([bounds, focal_point, color])

Add a cursor of a PyVista or VTK dataset to the scene.

Plotter.add_floor([face, i_resolution, ...])

Show a floor mesh.

Plotter.add_key_event(key, callback)

Add a function to callback when the given key is pressed.

Plotter.add_legend([labels, bcolor, border, ...])

Add a legend to render window.

Plotter.add_legend_scale([...])

Annotate the render window with scale and distance information.

Plotter.add_light(light[, only_active])

Add a Light to the scene.

Plotter.add_line_widget(callback[, bounds, ...])

Add a line widget to the scene.

Plotter.add_lines(lines[, color, width, ...])

Add lines to the plotting object.

Plotter.add_logo_widget([logo, position, ...])

Add a logo widget to the top of the viewport.

Plotter.add_measurement_widget([callback, color])

Interactively measure distance with a distance widget.

Plotter.add_mesh(mesh[, color, style, ...])

Add any PyVista/VTK mesh or dataset that PyVista can wrap to the scene.

Plotter.add_mesh_clip_box(mesh[, invert, ...])

Clip a mesh using a box widget.

Plotter.add_mesh_clip_plane(mesh[, normal, ...])

Clip a mesh using a plane widget.

Plotter.add_mesh_isovalue(mesh[, scalars, ...])

Create a contour of a mesh with a slider.

Plotter.add_mesh_slice(mesh[, normal, ...])

Slice a mesh using a plane widget.

Plotter.add_mesh_slice_orthogonal(mesh[, ...])

Slice a mesh with three interactive planes.

Plotter.add_mesh_slice_spline(mesh[, ...])

Slice a mesh with a spline widget.

Plotter.add_mesh_threshold(mesh[, scalars, ...])

Apply a threshold on a mesh with a slider.

Plotter.add_north_arrow_widget([...])

Add a geographic north arrow to the scene.

Plotter.add_on_render_callback(callback[, ...])

Add a method to be called post-render.

Plotter.add_orientation_widget(actor[, ...])

Use the given actor in an orientation marker widget.

Plotter.add_plane_widget(callback[, normal, ...])

Add a plane widget to the scene.

Plotter.add_point_labels(points, labels[, ...])

Create a point actor with one label from list labels assigned to each point.

Plotter.add_point_scalar_labels(points, labels)

Label the points from a dataset with the values of their scalars.

Plotter.add_points(points[, style])

Add points to a mesh.

Plotter.add_radio_button_widget(callback, ...)

Add a radio button widget to the scene.

Plotter.add_ruler(pointa, pointb[, ...])

Add ruler.

Plotter.add_scalar_bar([title, mapper, ...])

Create scalar bar using the ranges as set by the last input mesh.

Plotter.add_silhouette(mesh[, color, ...])

Add a silhouette of a PyVista or VTK dataset to the scene.

Plotter.add_slider_widget(callback, rng[, ...])

Add a slider bar widget.

Plotter.add_sphere_widget(callback[, ...])

Add one or many sphere widgets to a scene.

Plotter.add_spline_widget(callback[, ...])

Create and add a spline widget to the scene.

Plotter.add_text(text[, position, ...])

Add text to plot object in the top left corner by default.

Plotter.add_text_slider_widget(callback, data)

Add a text slider bar widget.

Plotter.add_timer_event(max_steps, duration, ...)

Add a function to callback as timer event.

Plotter.add_title(title[, font_size, color, ...])

Add text to the top center of the plot.

Plotter.add_volume(volume[, scalars, clim, ...])

Add a volume, rendered using a smart mapper by default.

Plotter.add_volume_clip_plane(volume[, ...])

Clip a volume using a plane widget.

Plotter.clear()

Clear plot by removing all actors and properties.

Plotter.clear_actors()

Clear actors from all renderers.

Plotter.clear_box_widgets()

Remove all of the box widgets.

Plotter.clear_button_widgets()

Remove all of the button widgets.

Plotter.clear_camera3d_widgets()

Remove all of the camera3d widgets.

Plotter.clear_camera_widgets()

Remove all of the camera widgets.

Plotter.clear_events_for_key(key[, ...])

Remove the callbacks associated to the key.

Plotter.clear_line_widgets()

Remove all of the line widgets.

Plotter.clear_logo_widgets()

Remove all of the logo widgets.

Plotter.clear_measure_widgets()

Remove all of the measurement widgets.

Plotter.clear_on_render_callbacks()

Clear all callback methods previously registered with render().

Plotter.clear_plane_widgets()

Remove all of the plane widgets.

Plotter.clear_radio_button_widgets()

Remove all of the radio button widgets.

Plotter.clear_slider_widgets()

Remove all of the slider widgets.

Plotter.clear_sphere_widgets()

Remove all of the sphere widgets.

Plotter.clear_spline_widgets()

Remove all of the spline widgets.

Plotter.close()

Close the render window.

Plotter.deep_clean()

Clean the plotter of the memory.

Plotter.disable()

Disable this renderer's camera from being interactive.

Plotter.disable_3_lights()

Please use enable_lightkit, this method has been deprecated.

Plotter.disable_anti_aliasing([all_renderers])

Disable anti-aliasing.

Plotter.disable_depth_of_field()

Disable depth of field plotting.

Plotter.disable_depth_peeling()

Disable depth peeling.

Plotter.disable_eye_dome_lighting()

Disable eye dome lighting (EDL).

Plotter.disable_hidden_line_removal([...])

Disable hidden line removal.

Plotter.disable_parallel_projection()

Reset the camera to use perspective projection.

Plotter.disable_picking()

Disable any active picking and remove observers.

Plotter.disable_shadows()

Disable shadows.

Plotter.disable_ssao()

Disable surface space ambient occlusion (SSAO).

Plotter.disable_stereo_render()

Disable anaglyph stereo rendering.

Plotter.enable()

Enable this renderer's camera to be interactive.

Plotter.enable_2d_style()

Set the interactive style to 2D.

Plotter.enable_3_lights([only_active])

Enable 3-lights illumination.

Plotter.enable_anti_aliasing([aa_type, ...])

Enable anti-aliasing.

Plotter.enable_block_picking([callback, side])

Enable composite block picking.

Plotter.enable_cell_picking([callback, ...])

Enable picking of cells with a rectangle selection tool.

Plotter.enable_custom_trackball_style([...])

Set the interactive style to a custom style based on Trackball Camera.

Plotter.enable_depth_of_field([...])

Enable depth of field plotting.

Plotter.enable_depth_peeling([...])

Enable depth peeling to improve rendering of translucent geometry.

Plotter.enable_element_picking([callback, ...])

Select individual elements on a mesh.

Plotter.enable_eye_dome_lighting()

Enable eye dome lighting (EDL).

Plotter.enable_fly_to_right_click([callback])

Set the camera to track right click positions.

Plotter.enable_geodesic_picking([callback, ...])

Enable picking at geodesic paths.

Plotter.enable_hidden_line_removal([...])

Enable hidden line removal.

Plotter.enable_horizon_picking([callback, ...])

Enable horizon picking.

Plotter.enable_image_style()

Set the interactive style to Image.

Plotter.enable_joystick_actor_style()

Set the interactive style to Joystick Actor.

Plotter.enable_joystick_style()

Set the interactive style to Joystick Camera.

Plotter.enable_lightkit([only_active])

Enable the default light-kit lighting.

Plotter.enable_mesh_picking([callback, ...])

Enable picking of a mesh.

Plotter.enable_parallel_projection()

Enable parallel projection.

Plotter.enable_path_picking([callback, ...])

Enable picking at paths.

Plotter.enable_point_picking([callback, ...])

Enable picking at points under the cursor.

Plotter.enable_rectangle_picking([callback, ...])

Enable rectangle based picking at cells.

Plotter.enable_rectangle_through_picking([...])

Enable rectangle based cell picking through the scene.

Plotter.enable_rectangle_visible_picking([...])

Enable rectangle based cell picking on visible surfaces.

Plotter.enable_rubber_band_2d_style()

Set the interactive style to Rubber Band 2D.

Plotter.enable_rubber_band_style()

Set the interactive style to Rubber Band Picking.

Plotter.enable_shadows()

Enable shadows.

Plotter.enable_ssao([radius, bias, ...])

Enable surface space ambient occlusion (SSAO).

Plotter.enable_stereo_render()

Enable anaglyph stereo rendering.

Plotter.enable_surface_point_picking([...])

Enable picking of a point on the surface of a mesh.

Plotter.enable_terrain_style([...])

Set the interactive style to Terrain.

Plotter.enable_trackball_actor_style()

Set the interactive style to Trackball Actor.

Plotter.enable_trackball_style()

Set the interactive style to Trackball Camera.

Plotter.enable_zoom_style()

Set the interactive style to Rubber Band Zoom.

Plotter.export_gltf(filename[, inline_data, ...])

Export the current rendering scene as a glTF file.

Plotter.export_html(filename)

Export this plotter as an interactive scene to a HTML file.

Plotter.export_obj(filename)

Export scene to OBJ format.

Plotter.export_vrml(filename)

Export the current rendering scene as a VRML file.

Plotter.export_vtksz([filename, format])

Export this plotter as a VTK.js OfflineLocalView file.

Plotter.fly_to(point)

Move the current camera's focal point to a position point.

Plotter.fly_to_mouse_position([focus])

Focus on last stored mouse position.

Plotter.generate_orbital_path([factor, ...])

Generate an orbital path around the data scene.

Plotter.get_default_cam_pos([negative])

Return the default focal points and viewup.

Plotter.get_image_depth([fill_value, ...])

Return a depth image representing current render window.

Plotter.get_pick_position()

Get the pick position or area.

Plotter.hide_axes()

Hide the axes orientation widget.

Plotter.hide_axes_all()

Hide the axes orientation widget in all renderers.

Plotter.image_scale_context([scale])

Set the image scale in an isolated context.

Plotter.import_3ds(filename)

Import a 3DS file into the plotter.

Plotter.import_gltf(filename[, set_camera])

Import a glTF file into the plotter.

Plotter.import_obj(filename[, filename_mtl])

Import from .obj wavefront files.

Plotter.import_vrml(filename)

Import a VRML file into the plotter.

Plotter.increment_point_size_and_line_width(...)

Increment point size and line width of all actors.

Plotter.isometric_view()

Reset the camera to a default isometric view.

Plotter.isometric_view_interactive()

Set the current interactive render window to isometric view.

Plotter.key_press_event(*args)

Listen for key press event.

Plotter.left_button_down(*args)

Register the event for a left button down click.

Plotter.link_views([views])

Link the views' cameras.

Plotter.open_gif(filename[, loop, fps, ...])

Open a gif file.

Plotter.open_movie(filename[, framerate, ...])

Establish a connection to the ffmpeg writer.

Plotter.orbit_on_path([path, focus, step, ...])

Orbit on the given path focusing on the focus point.

Plotter.pick_click_position()

Get corresponding click location in the 3D plot.

Plotter.pick_mouse_position()

Get corresponding mouse location in the 3D plot.

Plotter.remove_actor(actor[, reset_camera, ...])

Remove an actor from the Renderer.

Plotter.remove_all_lights([only_active])

Remove all lights from the scene.

Plotter.remove_background_image()

Remove the background image at the current renderer.

Plotter.remove_blurring()

Remove a single blurring pass.

Plotter.remove_bounding_box([render])

Remove bounding box.

Plotter.remove_bounds_axes()

Remove bounds axes.

Plotter.remove_chart(chart_or_index)

Remove a chart from this renderer.

Plotter.remove_environment_texture()

Remove the environment texture.

Plotter.remove_floors([clear_kwargs, render])

Remove all floor actors.

Plotter.remove_legend([render])

Remove the legend actor.

Plotter.remove_scalar_bar([title, render])

Remove a scalar bar.

Plotter.render()

Render the main window.

Plotter.reset_camera([render, bounds])

Reset the camera of the active render window.

Plotter.reset_camera_clipping_range()

Reset camera clipping planes.

Plotter.reset_key_events()

Reset all of the key press events to their defaults.

Plotter.save_graphic(filename[, title, ...])

Save a screenshot of the rendering window as a graphic file.

Plotter.screenshot([filename, ...])

Take screenshot at current camera position.

Plotter.set_background(color[, top, right, ...])

Set the background color.

Plotter.set_chart_interaction(interactive[, ...])

Set or toggle interaction with charts for the active renderer.

Plotter.set_color_cycler(color_cycler[, ...])

Set or reset the color cycler.

Plotter.set_environment_texture(texture[, ...])

Set the environment texture used for image based lighting.

Plotter.set_focus(point)

Set focus to a point.

Plotter.set_position(point[, reset, render])

Set camera position to a point.

Plotter.set_scale([xscale, yscale, zscale, ...])

Scale all the actors in the scene.

Plotter.set_viewup(vector[, reset, render])

Set camera viewup vector.

Plotter.show([title, window_size, ...])

Display the plotting window.

Plotter.show_axes()

Show the axes orientation widget.

Plotter.show_axes_all()

Show the axes orientation widget in all renderers.

Plotter.show_bounds([mesh, bounds, ...])

Add bounds axes.

Plotter.show_grid(**kwargs)

Show grid lines and bounds axes labels.

Plotter.store_click_position(*args)

Store click position in viewport coordinates.

Plotter.store_mouse_position(*args)

Store mouse position.

Plotter.subplot(index_row[, index_column])

Set the active subplot.

Plotter.track_click_position([callback, ...])

Keep track of the click position.

Plotter.track_mouse_position()

Keep track of the mouse position.

Plotter.unlink_views([views])

Unlink the views' cameras.

Plotter.untrack_click_position([side])

Stop tracking the click position.

Plotter.untrack_mouse_position()

Stop tracking the mouse position.

Plotter.update([stime, force_redraw])

Update window, redraw, process messages query.

Plotter.update_bounds_axes()

Update the bounds axes of the render window.

Plotter.update_coordinates(points[, mesh, ...])

Update the points of an object in the plotter.

Plotter.update_scalar_bar_range(clim[, name])

Update the value range of the active or named scalar bar.

Plotter.update_scalars(scalars[, mesh, render])

Update scalars of an object in the plotter.

Plotter.view_isometric([negative, render, ...])

Reset the camera to a default isometric view.

Plotter.view_vector(vector[, viewup, ...])

Point the camera in the direction of the given vector.

Plotter.view_xy([negative, render, bounds])

View the XY plane.

Plotter.view_xz([negative, render, bounds])

View the XZ plane.

Plotter.view_yx([negative, render, bounds])

View the YX plane.

Plotter.view_yz([negative, render, bounds])

View the YZ plane.

Plotter.view_zx([negative, render, bounds])

View the ZX plane.

Plotter.view_zy([negative, render, bounds])

View the ZY plane.

Plotter.where_is(name)

Return the subplot coordinates of a given actor.

Plotter.window_size_context([window_size])

Set the render window size in an isolated context.

Plotter.write_frame()

Write a single frame to the movie file.

Plotter.zoom_camera(value)

Zoom of the camera and render.

Attributes

Plotter.actors

Return the actors of the active renderer.

Plotter.background_color

Return the background color of the active render window.

Plotter.bounds

Return the bounds of the active renderer.

Plotter.camera

Return the active camera of the active renderer.

Plotter.camera_position

Return camera position of the active render window.

Plotter.camera_set

Return or set if the camera of the active renderer has been set.

Plotter.center

Return the center of the active renderer.

Plotter.click_position

Plotter.image

Return an image array of current render window.

Plotter.image_depth

Return a depth image representing current render window.

Plotter.image_scale

Get or set the scale factor when saving a screenshot.

Plotter.last_update_time

Plotter.legend

Legend actor.

Plotter.length

Return the length of the diagonal of the bounding box of the scene.

Plotter.meshes

Return plotter meshes.

Plotter.mouse_position

Plotter.parallel_projection

Return or set parallel projection state of active render window.

Plotter.parallel_scale

Return or set parallel scale of active render window.

Plotter.pickable_actors

Return or set the pickable actors.

Plotter.picked_actor

Return the picked mesh.

Plotter.picked_block_index

Return the picked block index.

Plotter.picked_cell

Return the picked cell.

Plotter.picked_cells

Return the picked cells.

Plotter.picked_mesh

Return the picked mesh.

Plotter.picked_point

Return the picked point.

Plotter.render_window

Access the vtkRenderWindow attached to this plotter.

Plotter.renderer

Return the active renderer.

Plotter.scalar_bar

First scalar bar (kept for backwards compatibility).

Plotter.scalar_bars

Scalar bars.

Plotter.scale

Return the scaling of the active renderer.

Plotter.shape

Return the shape of the plotter.

Plotter.suppress_rendering

Get or set whether to suppress render calls.

Plotter.theme

Return or set the theme used for this plotter.

Plotter.window_size

Return the render window size in (width, height).