scanpathplot#

pymovements.plotting.scanpathplot(gaze: Gaze | None = None, position_column: str = 'location', cval: ndarray | None = None, cmap: Colormap | None = None, cmap_norm: Normalize | str | None = None, cmap_segmentdata: dict[Literal['red', 'green', 'blue', 'alpha'], Sequence[tuple[float, ...]]] | None = None, cbar_label: str | None = None, show_cbar: bool = False, padding: float | None = None, pad_factor: float | None = 0.05, figsize: tuple[int, int] = (15, 5), title: str | None = None, savepath: str | None = None, show: bool = True, color: str = 'blue', alpha: float = 0.5, add_traceplot: bool = False, gaze_position_column: str = 'pixel', add_stimulus: bool = False, add_arrows: bool = True, arrow_color: str = 'black', arrow_rad: float = 0.25, arrowstyle: str = 'simple', mutation_scale: float = 40.0, path_to_image_stimulus: str | None = None, stimulus_origin: str = 'upper', events: Events | EventDataFrame | None = None, *, event_name: str = 'fixation', ax: Axes | None = None, closefig: bool | None = None) tuple[Figure, Axes][source]#

Plot scanpath from positional data.

Parameters:
  • gaze (Gaze | None) – Optional Gaze Dataframe. (default: None)

  • position_column (str) – The column name of the x and y position data (default: ‘location’)

  • cval (np.ndarray | None) – Line color values. (default: None)

  • cmap (matplotlib.colors.Colormap | None) – Color map for line color values. (default: None)

  • cmap_norm (matplotlib.colors.Normalize | str | None) – Normalization for color values. (default: None)

  • cmap_segmentdata (LinearSegmentedColormapType | None) – Color map segmentation to build color map. (default: None)

  • cbar_label (str | None) – String label for color bar. (default: None)

  • show_cbar (bool) – Shows color bar if True. (default: False)

  • padding (float | None) – Absolute padding value. If None, it is inferred from pad_factor and limits. (default: None)

  • pad_factor (float | None) – Relative padding factor to construct padding value if not given. (default: 0.5)

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

  • title (str | None) – Set 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)

  • color (str) – Color of fixations. (default: ‘blue’)

  • alpha (float) – Alpha value of scanpath. (default: 0.5)

  • add_traceplot (bool) – Boolean value indicating whether to add traceplot to the scanpath plot. (default: False)

  • gaze_position_column (str) – Position column in the gaze dataframe. (default: ‘pixel’)

  • add_stimulus (bool) – Boolean value indicating whether to plot the scanpath on the stimuls. (default: False)

  • add_arrows (bool) – Boolean value indicating whether to plot the scanpath with arrows connecting events. (default: True)

  • arrow_color (str) – Color of arrows. (default: ‘black’)

  • arrow_rad (float) – Controlling the curvature of the arrows. (default: 0.25)

  • arrowstyle (str) – The styling of arrow head, tail and shaft. (default: ‘simple’)

  • mutation_scale (float) – Value with which attributes of arrowstyle will be scaled. (default: 40.)

  • path_to_image_stimulus (str | None) – Path of the stimulus to be shown. (default: None)

  • stimulus_origin (str) – Origin of stimuls to plot on the stimulus. (default: ‘upper’)

  • events (Events | EventDataFrame | None) – The events to plot. (default: None)

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

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

  • closefig (bool | None) – Whether to close the figure. If None, close only when the function created the figure.

Returns:

The created or provided figure and axes.

Return type:

tuple[plt.Figure, plt.Axes]

Raises:
  • TypeError – If both gaze and events are ‘None’.

  • ValueError – If length of x and y coordinates do not match or if cmap_norm is unknown.