Plotting

Visualization utilities for calibration and validation data.

Plotting utilities for EyeLink calibration and validation data.

class syelink.plotting.CalibrationPlotStyle(color_left='cyan', color_right='magenta', marker='+', marker_size=300, marker_linewidth=2, show_grid=True, grid_alpha=0.3, figsize=(16, 7), dpi=150, title_fontsize=14, label_fontsize=12)[source]

Bases: object

Style configuration for calibration plots.

Example

>>> style = CalibrationPlotStyle(
...     color_left="green",
...     color_right="purple",
... )
>>> plot_calibration_raw(session, style=style)
Parameters:
color_left: str = 'cyan'
color_right: str = 'magenta'
marker: str = '+'
marker_size: float = 300
marker_linewidth: float = 2
show_grid: bool = True
grid_alpha: float = 0.3
figsize: tuple[float, float] = (16, 7)
dpi: int = 150
title_fontsize: float = 14
label_fontsize: float = 12
class syelink.plotting.ValidationPlotStyle(color_left='#00FFFF', color_right='#4169E1', color_target='#000000', color_screen='#888888', marker='+', marker_size=200, marker_linewidth=2, line_style='--', line_width=1.5, line_alpha=0.8, label_fontsize=11, label_fontweight='bold', show_labels=True, figsize=(12, 10), dpi=150, title_fontsize=14, show_legend=True, legend_loc='upper right', legend_fontsize=10)[source]

Bases: object

Style configuration for validation plots.

All colors can be any matplotlib-compatible color string (hex, named colors, RGB tuples, etc.)

Example

>>> style = ValidationPlotStyle(
...     color_left="red",
...     color_right="blue",
...     marker_size=300,
... )
>>> plot_validation(session, style=style)
Parameters:
color_left: str = '#00FFFF'
color_right: str = '#4169E1'
color_target: str = '#000000'
color_screen: str = '#888888'
marker: str = '+'
marker_size: float = 200
marker_linewidth: float = 2
line_style: str = '--'
line_width: float = 1.5
line_alpha: float = 0.8
label_fontsize: float = 11
label_fontweight: str = 'bold'
show_labels: bool = True
figsize: tuple[float, float] = (12, 10)
dpi: int = 150
title_fontsize: float = 14
show_legend: bool = True
legend_loc: str = 'upper right'
legend_fontsize: float = 10
syelink.plotting.plot_calibration_raw(session, cal_index=0, save_path=None, style=None)[source]

Plot RAW calibration points for both eyes on single plot.

Parameters:
  • session (SessionData) – SessionData object containing calibration data

  • cal_index (int) – Which calibration to plot (0-based index)

  • save_path (str | Path | None) – Optional path to save the figure

  • style (CalibrationPlotStyle | None) – Optional CalibrationPlotStyle for customizing colors, markers, etc.

Return type:

Figure

Returns:

matplotlib Figure object

Example

>>> from syelink.plotting import plot_calibration_raw, CalibrationPlotStyle
>>> style = CalibrationPlotStyle(color_left="green", color_right="orange")
>>> fig = plot_calibration_raw(session, style=style)
syelink.plotting.plot_validation(session, validation_index=0, save_path=None, target_scale=0.015, target_image_path=None, style=None, show_connectors=False)[source]

Plot a single validation showing left and right eye data.

Parameters:
  • session (SessionData) – SessionData object containing validation data

  • validation_index (int) – Index of validation to plot (0-based)

  • save_path (str | Path | None) – Optional path to save the plot

  • target_scale (float) – Scaling factor for target image size (default: 0.015)

  • target_image_path (str | Path | None) – Optional path to custom target image

  • style (ValidationPlotStyle | None) – Optional ValidationPlotStyle for customizing colors, markers, etc.

  • show_connectors (bool) – Whether to draw connector lines from original label positions to adjusted label positions (default: False)

Return type:

Figure

Returns:

matplotlib Figure object

Example

>>> from syelink.plotting import plot_validation, ValidationPlotStyle
>>> style = ValidationPlotStyle(color_left="red", color_right="green")
>>> fig = plot_validation(session, style=style, show_connectors=True)

calibration

Plot calibration points (P-CR in HREF angular space) for both eyes.

Shows the polynomial input — the P-CR feature in HREF coordinates — at each cal target.

syelink.plotting.calibration.plot_calibration_raw(session, cal_index=0, save_path=None, style=None)[source]

Plot RAW calibration points for both eyes on single plot.

Parameters:
  • session (SessionData) – SessionData object containing calibration data

  • cal_index (int) – Which calibration to plot (0-based index)

  • save_path (str | Path | None) – Optional path to save the figure

  • style (CalibrationPlotStyle | None) – Optional CalibrationPlotStyle for customizing colors, markers, etc.

Return type:

Figure

Returns:

matplotlib Figure object

Example

>>> from syelink.plotting import plot_calibration_raw, CalibrationPlotStyle
>>> style = CalibrationPlotStyle(color_left="green", color_right="orange")
>>> fig = plot_calibration_raw(session, style=style)

validation

Create validation plots showing target positions and gaze offsets.

Shows left and right eye data with error vectors and offset labels.

syelink.plotting.validation.plot_validation(session, validation_index=0, save_path=None, target_scale=0.015, target_image_path=None, style=None, show_connectors=False)[source]

Plot a single validation showing left and right eye data.

Parameters:
  • session (SessionData) – SessionData object containing validation data

  • validation_index (int) – Index of validation to plot (0-based)

  • save_path (str | Path | None) – Optional path to save the plot

  • target_scale (float) – Scaling factor for target image size (default: 0.015)

  • target_image_path (str | Path | None) – Optional path to custom target image

  • style (ValidationPlotStyle | None) – Optional ValidationPlotStyle for customizing colors, markers, etc.

  • show_connectors (bool) – Whether to draw connector lines from original label positions to adjusted label positions (default: False)

Return type:

Figure

Returns:

matplotlib Figure object

Example

>>> from syelink.plotting import plot_validation, ValidationPlotStyle
>>> style = ValidationPlotStyle(color_left="red", color_right="green")
>>> fig = plot_validation(session, style=style, show_connectors=True)

style

Plot styling configuration for syelink visualizations.

class syelink.plotting.style.ValidationPlotStyle(color_left='#00FFFF', color_right='#4169E1', color_target='#000000', color_screen='#888888', marker='+', marker_size=200, marker_linewidth=2, line_style='--', line_width=1.5, line_alpha=0.8, label_fontsize=11, label_fontweight='bold', show_labels=True, figsize=(12, 10), dpi=150, title_fontsize=14, show_legend=True, legend_loc='upper right', legend_fontsize=10)[source]

Bases: object

Style configuration for validation plots.

All colors can be any matplotlib-compatible color string (hex, named colors, RGB tuples, etc.)

Example

>>> style = ValidationPlotStyle(
...     color_left="red",
...     color_right="blue",
...     marker_size=300,
... )
>>> plot_validation(session, style=style)
Parameters:
color_left: str = '#00FFFF'
color_right: str = '#4169E1'
color_target: str = '#000000'
color_screen: str = '#888888'
marker: str = '+'
marker_size: float = 200
marker_linewidth: float = 2
line_style: str = '--'
line_width: float = 1.5
line_alpha: float = 0.8
label_fontsize: float = 11
label_fontweight: str = 'bold'
show_labels: bool = True
figsize: tuple[float, float] = (12, 10)
dpi: int = 150
title_fontsize: float = 14
show_legend: bool = True
legend_loc: str = 'upper right'
legend_fontsize: float = 10
class syelink.plotting.style.CalibrationPlotStyle(color_left='cyan', color_right='magenta', marker='+', marker_size=300, marker_linewidth=2, show_grid=True, grid_alpha=0.3, figsize=(16, 7), dpi=150, title_fontsize=14, label_fontsize=12)[source]

Bases: object

Style configuration for calibration plots.

Example

>>> style = CalibrationPlotStyle(
...     color_left="green",
...     color_right="purple",
... )
>>> plot_calibration_raw(session, style=style)
Parameters:
color_left: str = 'cyan'
color_right: str = 'magenta'
marker: str = '+'
marker_size: float = 300
marker_linewidth: float = 2
show_grid: bool = True
grid_alpha: float = 0.3
figsize: tuple[float, float] = (16, 7)
dpi: int = 150
title_fontsize: float = 14
label_fontsize: float = 12