pymovements.plotting.heatmap#

pymovements.plotting.heatmap(gaze: GazeDataFrame, position_column: str = 'pixel', gridsize: tuple[int, int] = (10, 10), cmap: colors.Colormap | str = 'jet', interpolation: str = 'gaussian', origin: str = 'lower', figsize: tuple[float, float] = (15, 10), cbar_label: str | None = None, show_cbar: bool = True, title: str | None = None, xlabel: str | None = None, ylabel: str | None = None, show: bool = True, savepath: str | None = None) plt.Figure#

Plot a heatmap of gaze data.

The heatmap displays the distribution of gaze positions across the experiment screen, for a given GazeDataFrame object. The color values indicate the time spent at each position in seconds.

Parameters:
  • gaze (GazeDataFrame) – A GazeDataFrame object.

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

  • gridsize (tuple[int, int]) – The number of bins in the x and y dimensions. (default: (10, 10))

  • cmap (colors.Colormap | str) – The colormap to use. (default: ‘jet’)

  • interpolation (str) – The interpolation method to use for plotting the heatmap. See matplotlib.pyplot.imshow for more information on available methods for interpolation. (default: ‘gaussian’)

  • origin (str) – Set origin of y-axis, valid values are ‘lower’ or ‘upper’. (default: ‘lower’)

  • figsize (tuple[float, float]) – Figure size. (default: (15, 10))

  • cbar_label (str | None) – Label for the colorbar. (default: None)

  • show_cbar (bool) – Whether to show the colorbar. (default: True)

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

  • xlabel (str | None) – Set x-axis label. (default: None)

  • ylabel (str | None) – Set y-axis label. (default: None)

  • show (bool) – Whether to show the plot. (default: True)

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

Raises:
  • ValueError – If the position columns are not in pixels or degrees

  • ValueError – If the experiment property of the GazeDataFrame is None

Returns:

The heatmap figure.

Return type:

plt.Figure