Skip to contents

export_gazepoint_heatmap_png() saves a ggplot heatmap to a PNG file.

Usage

export_gazepoint_heatmap_png(
  plot,
  filename,
  width = 8,
  height = 5,
  units = "in",
  dpi = 300,
  create_dir = TRUE,
  ...
)

Arguments

plot

A ggplot object, usually returned by plot_gazepoint_heatmap() or plot_gazepoint_heatmap_overlay().

filename

Output file path.

width, height

Plot size passed to ggplot2::ggsave().

units

Units passed to ggplot2::ggsave().

dpi

Resolution passed to ggplot2::ggsave().

create_dir

Logical. If TRUE, the output directory is created when needed.

...

Additional arguments passed to ggplot2::ggsave().

Value

Invisibly returns the output path.

Examples

gaze <- data.frame(
  x = c(0.20, 0.25, 0.70),
  y = c(0.30, 0.35, 0.60)
)

p <- plot_gazepoint_heatmap(
  gaze,
  x_col = "x",
  y_col = "y",
  bins = 10
)

out <- tempfile(fileext = ".png")
export_gazepoint_heatmap_png(p, out, width = 4, height = 3)