pyvista.Plotter

class Plotter(*args, **kwargs)

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.

shapelist or tuple, 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. Default False.

border_colorstr or 3 item list, optional

Either a string, rgb list, or hex color string. For example:

  • color='white'

  • color='w'

  • color=[1, 1, 1]

  • color='#FFFFFF'

window_sizelist, optional

Window size in pixels. Defaults to [1024, 768], unless set differently in the relevant theme’s window_size property.

multi_samplesint, optional

The number of multi-samples used to mitigate aliasing. 4 is a good default but 8 will have better results with a potential impact on performance.

line_smoothingbool, optional

If True, enable line smoothing.

polygon_smoothingbool, optional

If True, enable polygon smoothing.

lightingstr, optional

What 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.themes.DefaultTheme, optional

Plot-specific theme.

Examples

>>> import pyvista
>>> from pyvista import examples
>>> mesh = examples.load_hexbeam()
>>> another_mesh = examples.load_uniform()
>>> plotter = pyvista.Plotter()
>>> actor = plotter.add_mesh(mesh, color='red')
>>> actor = plotter.add_mesh(another_mesh, color='blue')
>>> plotter.show()
../../../_images/pyvista-Plotter-1_00_00.png

Methods

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

Add an actor to render window.

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_bounding_box([color, ...])

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

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

Add a box widget to the scene.

Plotter.add_checkbox_button_widget(callback)

Add a checkbox button widget 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_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_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_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, **kwargs)

Add points to a mesh.

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

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

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_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.clear()

Clear plot by removing all actors and properties.

Plotter.clear_box_widgets()

Disable all of the box widgets.

Plotter.clear_button_widgets()

Disable all of the button widgets.

Plotter.clear_events_for_key(key)

Remove the callbacks associated to the key.

Plotter.clear_line_widgets()

Disable all of the line widgets.

Plotter.clear_plane_widgets()

Disable all of the plane widgets.

Plotter.clear_slider_widgets()

Disable all of the slider widgets.

Plotter.clear_sphere_widgets()

Disable all of the sphere widgets.

Plotter.clear_spline_widgets()

Disable all of the spline widgets.

Plotter.close([render])

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 depreciated.

Plotter.disable_anti_aliasing()

Disable anti-aliasing.

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_shadows()

Disable shadows.

Plotter.enable()

Enable this renderer's camera to be interactive.

Plotter.enable_3_lights([only_active])

Enable 3-lights illumination.

Plotter.enable_anti_aliasing()

Enable anti-aliasing using FXAA.

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

Enable picking at cells.

Plotter.enable_depth_peeling([...])

Enable depth peeling to improve rendering of translucent geometry.

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_parallel_projection()

Enable parallel projection.

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

Enable picking at paths.

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

Enable picking at points.

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_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_vtkjs(filename[, compress_arrays])

Export the current rendering scene as a VTKjs scene.

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.import_gltf(filename[, set_camera])

Import a glTF 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(obj, event)

Listen for key press event.

Plotter.left_button_down(obj, event_type)

Register the event for a left button down click.

Plotter.link_views([views])

Link the views' cameras.

Plotter.open_gif(filename)

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 from the current subplot.

Plotter.remove_bounding_box([render])

Remove bounding box.

Plotter.remove_bounds_axes()

Remove bounds axes.

Plotter.remove_floors([clear_kwargs, render])

Remove all floor actors.

Plotter.remove_legend()

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

Set the background color.

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])

Set camera position to a point.

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

Scale all the datasets in the scene.

Plotter.set_viewup(vector)

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 gridlines and 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.to_pythreejs()

Convert this plotting scene to a pythreejs renderer.

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()

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])

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])

View the XY plane.

Plotter.view_xz([negative])

View the XZ plane.

Plotter.view_yx([negative])

View the YX plane.

Plotter.view_yz([negative])

View the YZ plane.

Plotter.view_zx([negative])

View the ZX plane.

Plotter.view_zy([negative])

View the ZY plane.

Plotter.where_is(name)

Return the subplot coordinates of a given actor.

Plotter.write_frame()

Write a single frame to the movie file.

Attributes

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 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.last_update_time

Plotter.length

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

Plotter.mouse_position

Plotter.parallel_projection

Return parallel projection state of active render window.

Plotter.parallel_scale

Return parallel scale of active render window.

Plotter.picked_cells

Plotter.picked_geodesic

Plotter.picked_horizon

Plotter.picked_path

Plotter.picked_point

Plotter.renderer

Return the active renderer.

Plotter.right_timer_id

Plotter.scalar_bar

First scalar bar.

Plotter.scalar_bars

Scalar bars.

Plotter.scale

Return the scaling of the active renderer.

Plotter.shape

Shape of the plotter.

Plotter.store_image

Store last rendered frame on close.

Plotter.theme

Return or set the theme used for this plotter.

Plotter.window_size

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