knitr::opts_chunk$set(fig.width=8, fig.height=6)
library(eyer) obj <- eyer_data
Area allow us to define square areas and analyse the contents.
We can plot areas with the geom_area_boundaries
function.
resolution <- obj$info$resolution center <- AreaObject("center", c(resolution$width/2 - 200, resolution$width/2 + 200), c(resolution$height/2 - 200, resolution$height/2 + 200)) top_upper <- AreaObject("Top Upper", c(1500, 1920), c(750, 1080)) plot_gaze(obj, downsample = 50) + geom_area_boundaries(center, alpha = 0.005, fill="blue") + geom_area_boundaries(top_upper, alpha = 0.005, fill="green") + geom_eyer_monitor(obj)
And then we can add information about which area is each recording is to the gaze and fixations
obj <- add_area_column(obj, list(center, top_upper)) str(obj$data$gaze) table(obj$data$gaze$area)
Any recording not in given areas is assigned NA_character_
. We can then select only those recordings in arease.
fixations_in_areas <- obj$data$fixations[!is.na(obj$data$fixations$area),] ggplot(fixations_in_areas, aes(x,y, size=duration)) + geom_point() + geom_area_boundaries(center, alpha = 0.005, fill="blue") + geom_area_boundaries(top_upper, alpha = 0.005, fill="green") + geom_eyer_monitor(obj) + theme_minimal()
df <- analyse_fixation_areas(obj, list(center, top_upper)) print(df)
df <- analyse_gaze_areas(obj, list(center, top_upper)) print(df)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.