pynaviz.base_plot.PlotTsdFrame#
- class pynaviz.base_plot.PlotTsdFrame(data, index=None, parent=None, window_size=None, display_mode='lines', background='black')[source]#
Bases:
_BasePlotVisualization of a multi-column pynapple time series (
nap.TsdFrame).Supports three display modes toggled at runtime:
lines (default): each column rendered as a line with vertex colors.
image: all columns as a heatmap texture.
x_vs_y: one column plotted against another with a time marker.
- Parameters:
data (
nap.TsdFrame) – The column-based time series data.index (
int, optional) – Controller ID for synchronizing with other plots.parent (optional) – GUI parent widget (e.g. QWidget).
window_size (
float, optional) – Streaming window duration in seconds. If None, computed to fit up to 256 MB of memory.display_mode (
str, default"lines") – Initial display mode (“lines” or “image”). Toggle with the “m” key.background (
strortuple, optional) – Background color (e.g."white","black","#272822").
- __init__(data, index=None, parent=None, window_size=None, display_mode='lines', background='black')[source]#
Methods
__init__(data[, index, parent, window_size, ...])add_interval_sets(epochs[, colors, alpha, ...])animate()Updates the positions of rulers and reference lines based on the current world coordinate bounds and triggers a re-render of the scene.
close()color_by(metadata_name[, cmap_name, vmin, vmax])Apply color mapping to channels based on a metadata field.
from_state(state, available_vars)Restore the full plot state from a previously saved dict.
Return the current display mode and its serializable state.
Return the full serializable state of this plot.
group_by(metadata_name, **kwargs)Group channels vertically by a metadata field.
Jump to the start of the next superposed epoch (across all added interval sets).
Jump to the start of the previous superposed epoch (across all added interval sets).
plot_x_vs_y(x_col, y_col[, color, ...])Plot one column versus another with a time-point marker.
remove_interval_set(label)Remove an interval set from the plot.
set_plot_state(state[, available_vars])Restore display mode and mode-specific state.
show()To show the canvas in case of GLFW context used
sort_by(metadata_name[, mode])Sort channels vertically by a metadata field.
update_interval_set(name, colors, alpha)Update the color and transparency of an existing interval set.
Attributes
- add_interval_sets(epochs, colors=None, alpha=None, labels=None)#
- animate()#
Updates the positions of rulers and reference lines based on the current world coordinate bounds and triggers a re-render of the scene.
This method performs the following: - Computes the visible world coordinate bounds. - Updates the horizontal (x) and vertical (y) rulers accordingly. - Repositions the center time reference line in the scene. - Re-renders the scene using the current camera and canvas settings.
Notes
This method should be called whenever the visible region of the plot changes (e.g., after zooming, panning, or resizing the canvas).
- close()#
- property cmap#
- color_by(metadata_name, cmap_name='viridis', vmin=0.0, vmax=100.0)[source]#
Apply color mapping to channels based on a metadata field.
- property data#
- from_state(state, available_vars)#
Restore the full plot state from a previously saved dict.
Guards against missing keys so that layouts saved by older versions of pynaviz can still be loaded without error.
- Parameters:
state (
dict) – Dictionary produced byget_state().available_vars (
dict) – Mapping ofvariable name → nap variableused to look up overlays by name.
- get_plot_state()[source]#
Return the current display mode and its serializable state.
- Returns:
{"mode": str, "mode_state": ...}wheremode_stateis whatever the active mode’sget_state()returns.- Return type:
- get_state()#
Return the full serializable state of this plot.
Aggregates three layers:
"manager": sort_by / group_by / color_by actions."interval_sets": overlay color and alpha keyed by label."plot": plot-type-specific state (mode, scale, clim, …).
- Return type:
- property graphic#
The active pygfx graphic, delegated to the current display mode.
- group_by(metadata_name, **kwargs)[source]#
Group channels vertically by a metadata field.
- Parameters:
metadata_name (
str) – Metadata key to group by.
- jump_to_next_epoch()#
Jump to the start of the next superposed epoch (across all added interval sets).
- Return type:
None
- jump_to_previous_epoch()#
Jump to the start of the previous superposed epoch (across all added interval sets).
- Return type:
None
- plot_x_vs_y(x_col, y_col, color=None, thickness=1.0, markersize=10.0)[source]#
Plot one column versus another with a time-point marker.
- remove_interval_set(label)#
Remove an interval set from the plot.
- Parameters:
label (str) – The label of the interval set to be removed.
- Return type:
None
- set_plot_state(state, available_vars=None)[source]#
Restore display mode and mode-specific state.
- Parameters:
state (
dictorNone) – Value produced byget_plot_state().**available_vars – Unused, no extra argument needed.
- Return type:
None
- show()#
To show the canvas in case of GLFW context used
- update_interval_set(name, colors, alpha)#
Update the color and transparency of an existing interval set.