static_plot: Plot fixations in 2D space overlaied on a stimulus image

View source: R/VisualizationFunctions.R

static_plotR Documentation

Plot fixations in 2D space overlaied on a stimulus image

Description

This function plots and returns a ggplot2 figure showing fixations on a background with one or multiple images, typically the stimuli. Data can represent one or multiple participants The interval to plot is defined by sample numbers. Fixations must have the variables x, y, and onset. The function is tested with .jpg-images. If paths to multiple images are given, all will be displayed. Fixations are shown on a white background if no background images are defined

Usage

static_plot(
  gazedata,
  xres = 1920,
  yres = 1080,
  plot.onset,
  plot.offset,
  background.images = NA,
  show.legend = TRUE,
  group.by = NA,
  gazepoint.size = 4,
  id_color_map = NA,
  connect.lines = TRUE,
  verbose = TRUE
)

Arguments

gazedata

Data frame with fixation data which must include columns for x and y coordinates as well as the variable onset which indicates the onset of the fixation. If the categorical or factor variable id is included, separate colors will represent each participant. Make sure the onset variables match the timing the plot.onset and plot.offset input.

xres

horizontal resolution of the screen or area to plot on. Default 1920

yres

vertical resolution of the screen or area to plot on. Default 1080

plot.onset

Onset of the interval in the gaze_data$onset variable to plot in the same unit, typically milliseconds

plot.offset

Offset of the interval in the gaze_data$onset variable to plot in the same unit, typically milliseconds

background.images

data frame with background images to use as background. The data frame must include the variables min.x, min.y, max.x, and max.y variables representing where the images should be placed on the background and the variable path specifying a full file path. #Example: background.images <- data.frame( path = "my_image.jpg", min.x = 1, min.y = 1, max.x = 200. max.y = 200)

show.legend

If TRUE, show values in "id" in legend

group.by

If not NA, plot each level in the variable in a separate panel. For example group.by = "group" returns a separate panel for each group and group.by ="id" returns a separate panel for each id.

gazepoint.size

Size of the circle illustrating the point of gaze

id_color_map

A ggplot color map specifying a color to plot for each id. ids should match the variable id'in the gazedata matrix. Set to NA to assign values automatically.

connect.lines

If TRUE, gaze coordinates are connected with lines

verbose

If TRUE, the resulting figure is displayed automatically

Value

a ggplot of raw and fixated values plotted on the y axis and sample number on the x axis


kollaR documentation built on April 13, 2025, 5:11 p.m.