pymovements.plot

This module holds all plotting functions.

Functions

traceplot

Plot eye gaze trace from positional data.

tsplot

Plot time series with each channel getting a separate subplot.

pymovements.plot.traceplot(x: np.ndarray, y: np.ndarray, cval: np.ndarray | None = None, cmap: colors.Colormap | None = None, cmap_norm: colors.Normalize | str | None = None, cmap_segmentdata: dict[str, list[list[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) None[source]

Plot eye gaze trace from positional data.

Parameters
  • x (np.ndarray) – x-coordinates

  • y (np.ndarray) – y-coordinates

  • cval (np.ndarray) – line color values.

  • cmap (matplotlib.colors.Colormap, optional) – color map for line color values

  • cmap_norm (matplotlib.colors.Normalize, str, optional) – normalization for color values

  • cmap_segmentdata (dict, optional) – color map segmentation to build color map

  • cbar_label (str, optional) – string label for color bar

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

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

  • pad_factor (float, optional) – Relative padding factor to construct padding value if not given.

  • figsize (tuple) – Figure size.

  • title (str, optional) – Figure title.

  • savepath (str, optional) – If given, figure will be saved to this path.

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

Raises

ValueError – If length of x and y coordinates do not match.

pymovements.plot.tsplot(arr: np.array, channel_names: list[str] | None = None, xlabel: str | None = None, rotate_ylabels: bool = True, share_y: bool = True, zero_centered_yaxis: bool = True, line_color: tuple[int, int, int] | str = 'k', line_width: int = 1, show_grid: bool = True, show_yticks: bool = True, figsize: tuple[int, int] = (15, 5), title: str | None = None, savepath: str | None = None, show: bool = True) None[source]

Plot time series with each channel getting a separate subplot.

Parameters
  • arr (np.ndarray) – array with channeled time series

  • channel_names (list, optional) – list of channel names

  • xlabel (str, optional) – set x label

  • rotate_ylabels (bool) – set to rotate ylabels

  • share_y (bool) – set if y-axes should share common axis

  • zero_centered_yaxis (bool) – set if y-axis should be zero centered

  • line_color (tuple, str) – set line color

  • line_width (int) – set line width

  • show_grid (bool) – set to show grid

  • show_yticks (bool) – set to show yticks

  • figsize (tuple) – Figure size.

  • title (str, optional) – Figure title.

  • savepath (str, optional) – If given, figure will be saved to this path.

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

Raises

ValueError – If array has more than two dimensions.