Skip to main content

plotter

The underlying plotter instance used for all rendering. Created during Plotter initialization.

You can use this attribute to access the full PyVista/Qt API directly — anything not exposed by pyemsi.Plotter can be done through p.plotter.

Useful PyVista helpers

Camera

MethodDescription
view_xy()Look down the Z axis (XY plane). Common for 2D cross-sections.
view_xz()Look down the Y axis (XZ plane).
view_yz()Look down the X axis (YZ plane).
view_isometric()Reset to a default isometric view.
view_vector(vector)Point the camera in an arbitrary direction.
reset_camera()Reset the camera to fit all visible actors.
set_position(point)Set the camera position.
camera_positionGet or set the full camera position.
enable_parallel_projection()Switch to orthographic (parallel) projection.
zoom_camera(value)Zoom in or out.

Rendering & appearance

MethodDescription
add_mesh(mesh, ...)Add any PyVista/VTK mesh or dataset to the scene.
remove_actor(actor)Remove an actor from the scene.
set_background(color)Set the background color.
add_scalar_bar(...)Add or customise a scalar bar.
update_scalar_bar_range(clim)Change the color range of the active scalar bar.
add_text(text, ...)Add a text annotation to the scene.
add_axes(...)Add an interactive axes orientation widget.
show_grid()Show grid lines and axis labels.
add_bounding_box(...)Add a bounding box outline.
enable_anti_aliasing()Enable anti-aliasing for smoother edges.
enable_depth_peeling()Improve rendering of translucent geometry.

Export & screenshot

MethodDescription
screenshot(filename, ...)Take a screenshot at the current camera position.
export_html(filename)Export the scene as an interactive HTML file.
export_gltf(filename)Export as a glTF 3D file.
open_movie(filename)Open a video file for frame-by-frame recording.
write_frame()Write a single frame to the open video file.

Annotations & widgets

MethodDescription
add_point_labels(points, labels, ...)Label points with text.
add_legend(labels, ...)Add a legend to the render window.
add_ruler(pointa, pointb, ...)Add a ruler annotation between two points.
add_mesh_slice(mesh, ...)Add an interactive slicing plane widget.
add_mesh_isovalue(mesh, ...)Add an interactive isovalue/contour slider.
enable_point_picking(...)Enable interactive point picking.

Example

from pyemsi import Plotter, examples

file_path = examples.ipm_motor_path()
p = Plotter(file_path)
p.set_scalar("B-Mag (T)", scalar_bar_)

# Access the underlying plotter directly
p.plotter.view_xy()
p.plotter.set_background("black")
p.plotter.add_axes()

p.show()