main_sequence_plot#

pymovements.plotting.main_sequence_plot(events: Events | EventDataFrame | None = None, *, marker: str = 'o', marker_size: float = 25, marker_color: str = 'purple', marker_alpha: float = 0.5, fit: bool = True, fit_measure: bool | Literal['r2', 's'] = True, fit_color: str = 'red', figsize: tuple[int, int] = (15, 5), title: str | None = None, savepath: str | None = None, show: bool = True, event_df: Events | EventDataFrame | None = None, event_name: str = 'saccade', ax: Axes | None = None, closefig: bool | None = None, **kwargs: Collection) tuple[Figure, Axes][source]#

Plot the saccade main sequence.

Parameters:
  • events (Events | EventDataFrame | None) – It must contain columns “peak_velocity” and “amplitude”.

  • marker (str) – Marker symbol. Possible values defined by matplotlib.markers. (default: ‘o’)

  • marker_size (float) – Size of the marker symbol. (default: 25)

  • marker_color (str) – Color of the marker symbol. (default: ‘purple’)

  • marker_alpha (float) – Alpha value (=transparency) of the marker symbol. Between 0 and 1. (default: 0.5)

  • fit (bool) – Draw a linear fit line if True. If False, no line is drawn.

  • fit_measure (bool | Literal['r2', 's']) – Annotate a goodness-of-fit statistic: - True or 'r2': coefficient of determination (R²) - 's': standard error of the regression (S) - False: no annotation

  • fit_color (str) – Color of the linear fit line (default: ‘red’)

  • figsize (tuple[int, int]) – Figure size. (default: (15, 5))

  • title (str | None) – Figure title. (default: None)

  • savepath (str | None) – If given, figure will be saved to this path. (default: None)

  • show (bool) – If True, figure will be shown. (default: True)

  • event_df (Events | EventDataFrame | None) – It must contain columns “peak_velocity” and “amplitude”. (default: None) .. deprecated:: v0.22.0 Please use the events argument instead. This argument will be removed in v0.27.0.

  • event_name (str) – Filters events for a particular value in the “name” column. (default: ‘saccade’)

  • ax (plt.Axes | None) – External axes to draw into. If provided, the function will not show or close the figure.

  • closefig (bool | None) – Close figure after plotting. If None, defaults to closing only when the figure was created by this function.

  • **kwargs (Collection) – Additional keyword arguments passed to matplotlib.axes.Axes.scatter.

Returns:

The created or provided figure and axes.

Return type:

tuple[plt.Figure, plt.Axes]

Raises:
  • KeyError – If the input dataframe has no ‘amplitude’ and/or ‘peak_velocity’ column. Those are needed to create the plot.

  • ValueError – If the event dataframe does not contain any saccades.