OnlinePlotBase
- class OnlinePlotBase[source]
Bases:
objectClass to handle creation and management of Matplotlib figures to monitor behavioral data in real-time.
Use this with the variables you are registering in your task, that are part of Task.session_df.
Subclasses should override create_figure_and_axes (to create axes) and update_plot (to draw on existing axes).
- __init__() None[source]
Initializes the OnlinePlotBase instance.
Methods
__init__()Initializes the OnlinePlotBase instance.
close()Closes the matplotlib figure and resets the state.
Creates the figure and axes.
Ensures that the matplotlib figure exists, creating it if necessary.
update_canvas(df)Updates the plot with new data and redraws the canvas.
update_plot(df)Updates the plot content.
- ensure_figure() None[source]
Ensures that the matplotlib figure exists, creating it if necessary.
- close() None[source]
Closes the matplotlib figure and resets the state.
- update_canvas(df: pandas.DataFrame) None[source]
Updates the plot with new data and redraws the canvas.
- Parameters:
df (pd.DataFrame) – The dataframe containing the latest session data.
- create_figure_and_axes() None[source]
Creates the figure and axes. Should be overridden by subclasses.
- update_plot(df: pandas.DataFrame) None[source]
Updates the plot content. Should be overridden by subclasses.
- Parameters:
df (pd.DataFrame) – The dataframe containing the latest session data.