Plotters#
A plotter visualizes sampled data live as the scene steps, and can save the animation. Pass one as the rec_options argument of scene.start_recording. See Recording and playback for the recording workflow and the shared options (hz, buffer_size) that every plotter inherits.
A data function that returns a dict becomes one labeled subplot per key.
gs.recorders.PyQtLinePlot#
Live line plot backed by PyQtGraph. The fastest option for high-rate time-series data, at the cost of a PyQt dependency.
- class genesis.options.recorders.PyQtLinePlot(*, labels: tuple[str, ...] | dict[str, tuple[str, ...]] | None = None, x_label: str = '', y_label: str = '', history_length: int = 100, hz: float | None = None, buffer_size: int = 0, buffer_full_wait_time: float = 0.1, title: str = '', window_size: tuple[int, int] = (800, 600), save_to_filename: str | None = None, show_window: bool | None = None) None[source]#
Live line plot visualization of data using PyQtGraph.
The recorded data_func should return scalar data (single scalar, a tuple of scalars, or a dict with string keys and scalar or tuple of scalars as values).
- Parameters:
title (str) – The title of the plot.
window_size (tuple[int, int]) – The size of the window in pixels.
save_to_filename (str | None) – If provided, the animation will be saved to a file with the given filename.
show_window (bool | None) – Whether to show the window. If not provided, it will be set to True if a display is connected, False otherwise.
labels (tuple[str] | dict[str, tuple[str]] | None) – The labels for the plot. The length of the labels should match the length of the data. If a dict is provided, the data should also be a dict of tuples of strings that match the length of the data. The keys will be used as subplot titles and the values will be used as labels within each subplot.
x_label (str, optional) – Label for the horizontal axis.
y_label (str, optional) – Label for the vertical axis.
history_length (int) – The maximum number of previous data to store.
gs.recorders.MPLLinePlot#
Live line plot backed by Matplotlib. Use it for time-series data when a Matplotlib figure is preferred.
- class genesis.options.recorders.MPLLinePlot(*, labels: tuple[str, ...] | dict[str, tuple[str, ...]] | None = None, x_label: str = '', y_label: str = '', history_length: int = 100, hz: float | None = None, buffer_size: int = 0, buffer_full_wait_time: float = 0.1, title: str = '', window_size: tuple[int, int] = (800, 600), save_to_filename: str | None = None, show_window: bool | None = None) None[source]#
Live line plot visualization of data using matplotlib.
The recorded data_func should return scalar data (single scalar, a tuple of scalars, or a dict with string keys and scalar or tuple of scalars as values).
- Parameters:
title (str) – The title of the plot.
window_size (tuple[int, int]) – The size of the window in pixels.
save_to_filename (str | None) – If provided, the animation will be saved to a file with the given filename.
show_window (bool | None) – Whether to show the window. If not provided, it will be set to True if a display is connected, False otherwise.
labels (tuple[str] | dict[str, tuple[str]] | None) – The labels for the plot. The length of the labels should match the length of the data. If a dict is provided, the data should also be a dict of tuples of strings that match the length of the data. The keys will be used as subplot titles and the values will be used as labels within each subplot.
x_label (str, optional) – Label for the horizontal axis.
y_label (str, optional) – Label for the vertical axis.
history_length (int) – The maximum number of previous data to store.
gs.recorders.MPLImagePlot#
Displays a 2D array as a live image or heatmap, for example a camera frame or a sensor grid.
- class genesis.options.recorders.MPLImagePlot(*, hz: float | None = None, buffer_size: int = 0, buffer_full_wait_time: float = 0.1, title: str = '', window_size: tuple[int, int] = (800, 600), save_to_filename: str | None = None, show_window: bool | None = None) None[source]#
Live visualization of image data using matplotlib.
The image data should be an array-like object with shape (H, W), (H, W, 1), (H, W, 3), or (H, W, 4).
- Parameters:
title (str) – The title of the plot.
window_size (tuple[int, int]) – The size of the window in pixels.
save_to_filename (str | None) – If provided, the animation will be saved to a file with the given filename.
show_window (bool | None) – Whether to show the window. If not provided, it will be set to True if a display is connected, False otherwise.
gs.recorders.MPLVectorFieldPlot#
Draws a live vector field (quiver plot) from an array of 2D or 3D vectors.
- class genesis.options.recorders.MPLVectorFieldPlot(*, hz: float | None = None, buffer_size: int = 0, buffer_full_wait_time: float = 0.1, title: str = '', window_size: tuple[int, int] = (800, 600), save_to_filename: str | None = None, show_window: bool | None = None, positions: tuple[tuple[float, float, float], ...], normal: tuple[float, float, float] = (0.0, 0.0, 1.0), scale_factor: float = 1.0, max_magnitude: float = 1.0, subplot_titles: tuple[str, ...] | None = None) None[source]#
Live visualization of 3D vectors projected onto a 2D plane, colored by magnitude.
At initialization, provide the normal direction (view axis) and the 3D positions of each vector. The data_func should return an array of shape (N, 3) with the 3D vector at each position (e.g. displacement or force).
- Parameters:
title (str) – The title of the plot.
window_size (tuple[int, int]) – The size of the window in pixels.
positions (array-like of shape (N, 3)) – The 3D positions of each vector (e.g. probe positions in link-local frame).
normal (tuple[float, float, float]) – The normal direction for projection (view axis). Vectors and positions are projected onto the plane perpendicular to this axis. Default: (0, 0, 1).
scale_factor (float, optional) – The scale factor to apply to the vectors. Defaults to 0.1.
max_magnitude (float, optional) – Maximum magnitude for the colorbar (colors are fixed to [0, max_magnitude]). Defaults to 1.0.
subplot_titles (StrArrayType | None, optional) – If provided, the figure holds one subplot per title (K subplots in a near-square grid), all sharing
positions; the data_func then returns shape(K, N, 3)– one vector field per subplot.None(default) is a single plot whose data_func returns(N, 3).save_to_filename (str | None) – If provided, the animation will be saved to a file with the given filename.
show_window (bool | None) – Whether to show the window. If not provided, it will be set to True if a display is connected, False otherwise.
See also#
Recording and playback: the recording workflow and shared recorder options.
File writers: writing data to a file instead of plotting.