parq_blockmodel.utils.pyvista.custom_plotter.CustomPlotter

class parq_blockmodel.utils.pyvista.custom_plotter.CustomPlotter(*args, **kwargs)[source]

A custom PyVista Plotter with Z-up enforcement, picking, and directional camera view.

Examples

>>> grid = pv.ImageData(dimensions=(4, 4, 4), spacing=(1, 1, 1), origin=(0, 0, 0))
>>> grid.cell_data["block_id"] = np.arange(grid.n_cells)
>>>
>>> plotter = CustomPlotter()
>>> plotter.add_mesh(grid, show_edges=True)
>>> plotter.set_directional_view(direction='WSW', elevation_deg=30)
>>> plotter.add_axes()
>>> plotter.show()
__init__(*args, **kwargs)[source]

Initialize a vtk plotting object.

Methods

__init__(*args, **kwargs)

Initialize a vtk plotting object.

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

Add an actor to render window.

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

Add a 3D affine transform widget.

add_arrows(cent, direction[, mag])

Add arrows to the plotter.

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

Add an interactive axes widget in the bottom left corner.

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

Add axes actor at origin.

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

Add a background image to a plot.

add_blurring()

Add blurring.

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

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

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

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

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

Add a box widget to the scene.

add_camera3d_widget()

Add a camera3d widget allow to move the camera.

add_camera_orientation_widget([animate, ...])

Add a camera orientation widget to the active renderer.

add_chart(chart, *charts)

Add a chart to this renderer.

add_checkbox_button_widget(callback[, ...])

Add a checkbox button widget to the scene.

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

Add a composite dataset to the plotter.

add_cursor([bounds, focal_point, color])

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

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

Show a floor mesh.

add_key_event(key, callback)

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

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

Add a legend to render window.

add_legend_scale([corner_offset_factor, ...])

Annotate the render window with scale and distance information.

add_light(light[, only_active])

Add a Light to the scene.

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

Add a line widget to the scene.

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

Add lines to the plotting object.

add_logo_widget([logo, position, size, opacity])

Add a logo widget to the top of the viewport.

add_measurement_widget([callback, color])

Interactively measure distance with a distance widget.

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

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

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

Clip a mesh using a box widget.

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

Clip a mesh using a plane widget.

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

Create a contour of a mesh with a slider.

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

Slice a mesh using a plane widget.

add_mesh_slice_orthogonal(mesh[, ...])

Slice a mesh with three interactive planes.

add_mesh_slice_spline(mesh[, ...])

Slice a mesh with a spline widget.

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

Apply a threshold on a mesh with a slider.

add_north_arrow_widget([interactive, color, ...])

Add a geographic north arrow to the scene.

add_on_render_callback(callback[, render_event])

Add a method to be called post-render.

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

Use the given actor in an orientation marker widget.

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

Add a plane widget to the scene.

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

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

add_point_scalar_labels(points, labels[, ...])

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

add_points(points[, style])

Add points to a mesh.

add_radio_button_widget(callback, ...[, ...])

Add a radio button widget to the scene.

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

Add ruler.

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

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

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

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

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

Add a slider bar widget.

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

Add one or many sphere widgets to a scene.

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

Create and add a spline widget to the scene.

add_text(text[, position, font_size, color, ...])

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

add_text_slider_widget(callback, data[, ...])

Add a text slider bar widget.

add_timer_event(max_steps, duration, callback)

Add a function to callback as timer event.

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

Add text to the top center of the plot.

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

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

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

Clip a volume using a plane widget.

clear()

Clear plot by removing all actors and properties.

clear_actors()

Clear actors from all renderers.

clear_box_widgets()

Remove all of the box widgets.

clear_button_widgets()

Remove all of the button widgets.

clear_camera3d_widgets()

Remove all of the camera3d widgets.

clear_camera_widgets()

Remove all of the camera widgets.

clear_events_for_key(key[, raise_on_missing])

Remove the callbacks associated to the key.

clear_line_widgets()

Remove all of the line widgets.

clear_logo_widgets()

Remove all of the logo widgets.

clear_measure_widgets()

Remove all of the measurement widgets.

clear_on_render_callbacks()

Clear all callback methods previously registered with render().

clear_plane_widgets()

Remove all of the plane widgets.

clear_radio_button_widgets()

Remove all of the radio button widgets.

clear_slider_widgets()

Remove all of the slider widgets.

clear_sphere_widgets()

Remove all of the sphere widgets.

clear_spline_widgets()

Remove all of the spline widgets.

close()

Close the render window.

compute_bounds(*[, force_visibility, ...])

Return the bounds of actors present in the renderer.

deep_clean()

Clean the plotter of the memory.

disable()

Disable this renderer's camera from being interactive.

disable_3_lights()

Please use enable_lightkit, this method has been deprecated.

disable_anti_aliasing([all_renderers])

Disable anti-aliasing.

disable_depth_of_field()

Disable depth of field plotting.

disable_depth_peeling()

Disable depth peeling.

disable_eye_dome_lighting()

Disable eye dome lighting (EDL).

disable_hidden_line_removal([all_renderers])

Disable hidden line removal.

disable_parallel_projection()

Reset the camera to use perspective projection.

disable_picking()

Disable any active picking and remove observers.

disable_shadows()

Disable shadows.

disable_ssao()

Disable surface space ambient occlusion (SSAO).

disable_stereo_render()

Disable anaglyph stereo rendering.

enable()

Enable this renderer's camera to be interactive.

enable_2d_style()

Set the interactive style to 2D.

enable_3_lights([only_active])

Enable 3-lights illumination.

enable_anti_aliasing([aa_type, ...])

Enable anti-aliasing.

enable_block_picking([callback, side])

Enable composite block picking.

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

Enable picking of cells with a rectangle selection tool.

enable_custom_trackball_style([left, ...])

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

enable_depth_of_field([automatic_focal_distance])

Enable depth of field plotting.

enable_depth_peeling([number_of_peels, ...])

Enable depth peeling to improve rendering of translucent geometry.

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

Select individual elements on a mesh.

enable_eye_dome_lighting()

Enable eye dome lighting (EDL).

enable_fly_to_right_click([callback])

Set the camera to track right click positions.

enable_general_picking()

enable_geodesic_picking([callback, ...])

Enable picking at geodesic paths.

enable_hidden_line_removal([all_renderers])

Enable hidden line removal.

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

Enable horizon picking.

enable_image_style()

Set the interactive style to Image.

enable_joystick_actor_style()

Set the interactive style to Joystick Actor.

enable_joystick_style()

Set the interactive style to Joystick Camera.

enable_lightkit([only_active])

Enable the default light-kit lighting.

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

Enable picking of a mesh.

enable_parallel_projection()

Enable parallel projection.

enable_path_picking([callback, ...])

Enable picking at paths.

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

Enable picking at points under the cursor.

enable_rectangle_picking([callback, ...])

Enable rectangle based picking at cells.

enable_rectangle_through_picking([callback, ...])

Enable rectangle based cell picking through the scene.

enable_rectangle_visible_picking([callback, ...])

Enable rectangle based cell picking on visible surfaces.

enable_rubber_band_2d_style()

Set the interactive style to Rubber Band 2D.

enable_rubber_band_style()

Set the interactive style to Rubber Band Picking.

enable_shadows()

Enable shadows.

enable_ssao([radius, bias, kernel_size, blur])

Enable surface space ambient occlusion (SSAO).

enable_stereo_render()

Enable anaglyph stereo rendering.

enable_surface_point_picking([callback, ...])

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

enable_terrain_style([mouse_wheel_zooms, ...])

Set the interactive style to Terrain.

enable_trackball_actor_style()

Set the interactive style to Trackball Actor.

enable_trackball_style()

Set the interactive style to Trackball Camera.

enable_zoom_style()

Set the interactive style to Rubber Band Zoom.

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

Export the current rendering scene as a glTF file.

export_html(filename)

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

export_obj(filename)

Export scene to OBJ format.

export_vrml(filename)

Export the current rendering scene as a VRML file.

export_vtksz([filename, format])

Export this plotter as a VTK.js OfflineLocalView file.

fly_to(point)

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

fly_to_mouse_position([focus])

Focus on last stored mouse position.

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

Generate an orbital path around the data scene.

get_default_cam_pos([negative])

Return the default focal points and viewup.

get_image_depth([fill_value, ...])

Return a depth image representing current render window.

get_pick_position()

Get the pick position or area.

hide_axes()

Hide the axes orientation widget.

hide_axes_all()

Hide the axes orientation widget in all renderers.

image_scale_context([scale])

Set the image scale in an isolated context.

import_3ds(filename)

Import a 3DS file into the plotter.

import_gltf(filename[, set_camera])

Import a glTF file into the plotter.

import_obj(filename[, filename_mtl])

Import from .obj wavefront files.

import_vrml(filename)

Import a VRML file into the plotter.

increment_point_size_and_line_width(increment)

Increment point size and line width of all actors.

isometric_view()

Reset the camera to a default isometric view.

isometric_view_interactive()

Set the current interactive render window to isometric view.

key_press_event(*args)

Listen for key press event.

left_button_down(*args)

Register the event for a left button down click.

link_views([views])

Link the views' cameras.

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

Open a gif file.

open_movie(filename[, framerate, quality])

Establish a connection to the ffmpeg writer.

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

Orbit on the given path focusing on the focus point.

pick_click_position()

Get corresponding click location in the 3D plot.

pick_mouse_position()

Get corresponding mouse location in the 3D plot.

remove_actor(actor[, reset_camera, render])

Remove an actor from the Renderer.

remove_all_lights([only_active])

Remove all lights from the scene.

remove_background_image()

Remove the background image at the current renderer.

remove_blurring()

Remove a single blurring pass.

remove_bounding_box([render])

Remove bounding box.

remove_bounds_axes()

Remove bounds axes.

remove_chart(chart_or_index)

Remove a chart from this renderer.

remove_environment_texture()

Remove the environment texture.

remove_floors([clear_kwargs, render])

Remove all floor actors.

remove_legend([render])

Remove the legend actor.

remove_scalar_bar([title, render])

Remove a scalar bar.

render()

Render the main window.

reset_camera([render, bounds])

Reset the camera of the active render window.

reset_camera_clipping_range()

Reset camera clipping planes.

reset_key_events()

Reset all of the key press events to their defaults.

save_graphic(filename[, title, raster, painter])

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

screenshot([filename, ...])

Take screenshot at current camera position.

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

Set the background color.

set_chart_interaction(interactive[, toggle])

Set or toggle interaction with charts for the active renderer.

set_color_cycler(color_cycler[, all_renderers])

Set or reset the color cycler.

set_directional_view([direction, ...])

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

Set the environment texture used for image based lighting.

set_focus(point)

Set focus to a point.

set_position(point[, reset, render])

Set camera position to a point.

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

Scale all the actors in the scene.

set_viewup(vector[, reset, render])

Set camera viewup vector.

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

Display the plotting window.

show_axes()

Show the axes orientation widget.

show_axes_all()

Show the axes orientation widget in all renderers.

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

Add bounds axes.

show_grid(**kwargs)

Show grid lines and bounds axes labels.

store_click_position(*args)

Store click position in viewport coordinates.

store_mouse_position(*args)

Store mouse position.

subplot(index_row[, index_column])

Set the active subplot.

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

Keep track of the click position.

track_mouse_position()

Keep track of the mouse position.

unlink_views([views])

Unlink the views' cameras.

untrack_click_position([side])

Stop tracking the click position.

untrack_mouse_position()

Stop tracking the mouse position.

update([stime, force_redraw])

Update window, redraw, process messages query.

update_bounds_axes()

Update the bounds axes of the render window.

update_scalar_bar_range(clim[, name])

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

update_scalars(scalars[, mesh, render])

Update scalars of an object in the plotter.

view_isometric([negative, render, bounds])

Reset the camera to a default isometric view.

view_vector(vector[, viewup, render, bounds])

Point the camera in the direction of the given vector.

view_xy([negative, render, bounds])

View the XY plane.

view_xz([negative, render, bounds])

View the XZ plane.

view_yx([negative, render, bounds])

View the YX plane.

view_yz([negative, render, bounds])

View the YZ plane.

view_zx([negative, render, bounds])

View the ZX plane.

view_zy([negative, render, bounds])

View the ZY plane.

where_is(name)

Return the subplot coordinates of a given actor.

window_size_context([window_size])

Set the render window size in an isolated context.

write_frame()

Write a single frame to the movie file.

zoom_camera(value)

Zoom of the camera and render.

Attributes

HELP_TEXT_NAME

HOTKEYS

actors

Return the actors of the active renderer.

background_color

Return the background color of the active render window.

bounds

Return the bounds of all VISIBLE actors present in the active rendering window.

bounds_size

Return the size of each axis of the object's bounding box.

camera

Return the active camera of the active renderer.

camera_position

Return camera position of the active render window.

camera_set

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

center

Return the center of the active renderer.

click_position

image

Return an image array of current render window.

image_depth

Return a depth image representing current render window.

image_scale

Get or set the scale factor when saving a screenshot.

last_update_time

legend

Legend actor.

length

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

meshes

Return plotter meshes.

mouse_position

parallel_projection

Return or set parallel projection state of active render window.

parallel_scale

Return or set parallel scale of active render window.

pickable_actors

Return or set the pickable actors.

picked_actor

Return the picked mesh.

picked_block_index

Return the picked block index.

picked_cell

Return the picked cell.

picked_cells

Return the picked cells.

picked_mesh

Return the picked mesh.

picked_point

Return the picked point.

render_window

Access the :vtk:`vtkRenderWindow` attached to this plotter.

renderer

Return the active renderer.

scalar_bar

First scalar bar (kept for backwards compatibility).

scalar_bars

Scalar bars.

scale

Return the scaling of the active renderer.

shape

Return the shape of the plotter.

suppress_rendering

Get or set whether to suppress render calls.

theme

Return or set the theme used for this plotter.

window_size

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