sdynpy.core.sdynpy_geometry.TransientPlotter
- class TransientPlotter(geometry, displacement_data, displacement_scale=1.0, frames_per_second=20, undeformed_opacity=0.0, deformed_opacity=1.0, plot_kwargs={}, transformation_shapes=None, num_curves=50, show: bool = True, app=None, window_size=None, off_screen=None, allow_quit_keypress=True, toolbar=True, menu_bar=True, editor=False, update_app_icon=None, **kwargs)[source]
Bases:
GeometryPlotter
Class used to plot transient deformations
- __init__(geometry, displacement_data, displacement_scale=1.0, frames_per_second=20, undeformed_opacity=0.0, deformed_opacity=1.0, plot_kwargs={}, transformation_shapes=None, num_curves=50, show: bool = True, app=None, window_size=None, off_screen=None, allow_quit_keypress=True, toolbar=True, menu_bar=True, editor=False, update_app_icon=None, **kwargs)[source]
Create a TransientPlotter object to plot displacements over time
- Parameters
geometry (Geometry) – Geometry on which the displacements will be plotted
displacement_data (TimeHistoryArray) – Transient displacement data that will be applied
displacement_scale (float, optional) – Scale factor applied to displacements. The default is 1.0.
frames_per_second (float, optional) – Number of time steps to plot per second while the displacement is animating. Default is 20.
undeformed_opacity (float, optional) – Opacity of the undeformed geometry. The default is 0.0, or completely transparent.
deformed_opacity (float, optional) – Opacity of the deformed geometry. The default is 1.0, or completely opaque.
plot_kwargs (dict, optional) – Keyword arguments passed to the Geometry.plot function
transformation_shapes (ShapeArray) – Shape matrix that will be used to expand the data. Must be the same size as the displacement_data
num_curves (int, optional) – Maximum number of curves to plot on the time selector. Default is 50
show (bool, optional) – Show the plotting window. If
False
, show this window by runningshow()
. The default is True.app (QApplication, optional) – Creates a QApplication if left as None. The default is None.
window_size (list of int, optional) – Window size in pixels. Defaults to
[1024, 768]
off_screen (TYPE, optional) – Renders off screen when True. Useful for automated screenshots or debug testing. The default is None.
allow_quit_keypress (bool, optional) – Allow user to exit by pressing
"q"
. The default is True.toolbar (bool, optional) – If True, display the default camera toolbar. Defaults to True.
menu_bar (bool, optional) – If True, display the default main menu. Defaults to True.
editor (TYPE, optional) – If True, display the VTK object editor. Defaults to False.
update_app_icon (bool, optional) – If True, update_app_icon will be called automatically to update the Qt app icon based on the current rendering output. If None, the logo of PyVista will be used. If False, no icon will be set. Defaults to None. The default is None.
title (str, optional) – Title of plotting window.
multi_samples (int, 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_smoothing (bool, optional) – If True, enable line smothing
point_smoothing (bool, optional) – If True, enable point smothing
polygon_smoothing (bool, optional) – If True, enable polygon smothing
auto_update (float, bool, optional) – Automatic update rate in seconds. Useful for automatically updating the render window when actors are change without being automatically
Modified
. If set toTrue
, update rate will be 1 second.
- Return type
None.
Methods
__init__
(geometry, displacement_data[, ...])Create a TransientPlotter object to plot displacements over time
Adds the menu bar to the BackgroundPlotter
Adds toolbars to the BackgroundPlotter
save_animation
([filename, frame_rate, ...])Saves the current shape animation to a file
Adjusts the current shape scaling by 0.25x
Adjusts the current shape scaling by 0.5x
Adjusts the current shape scaling by 0.8x
Resets shape scaling to 1
Adjusts the current shape scaling by 1.25x
Adjusts the current shape scaling by 2x
Adjusts the current shape scaling by 4x
Adjusts the current animation speed by 0.8
Resets animation speed to default quantities
Adjusts the current animation speed by 1.25
update_displacement
([update_selector])Attributes
Adds the menu bar to the BackgroundPlotter
- save_animation(filename=None, frame_rate=20, individual_images=False, start_time=None, stop_time=None, step=None)[source]
Saves the current shape animation to a file
- Parameters
filename (str, optional) – Path to the file being saved. The default is None, which returns the images as an array rather than saves them to a file
frame_rate (float, optional) – Number of frames per second if the animation is saved to a GIF. The default is 20.
individual_images (bool, optional) – Boolean to specify whether the images are saved as individual PNG files or a single GIF. The default is False.
start_time (float, optional) – Time value at which the animation will start. Default is first time step
stop_time (float, optional) – Time value at which the animation will end. Default is last time step
step (int, optional) – Only render every
step
time steps. Default is to render all timesteps
- Returns
imgs – Returns array of images if filename is None, otherwise returns None
- Return type
np.ndarray or None