as_ggplot: Convert stimuli to a ggplot

View source: R/as_ggplot.R

as_ggplotR Documentation

Convert stimuli to a ggplot

Description

Convert a stimulus or list of stimuli into a ggplot, which can be further used with ggplot functions.

Usage

as_ggplot(stimuli, ...)

Arguments

stimuli

list of stimuli

...

Additional arguments to pass to plot_stim() if stimuli contains more than 1 image

Value

a ggplot object

See Also

Visualisation functions draw_tem(), gglabel(), label(), mlabel(), plot.stimlist(), plot.stim(), plot_rows(), plot_stim()

Examples

stimuli <- demo_stim()
gg <- as_ggplot(stimuli)

# add to ggplot object; coordinates are pixels
# (images are 500x500 each, plus 10px padding)
gg + 
  ggplot2::geom_vline(xintercept = 0, color = "red") +
  ggplot2::geom_vline(xintercept = 1030, color = "blue") +
  ggplot2::geom_hline(yintercept = 0, color = "green") +
  ggplot2::geom_hline(yintercept = 520, color = "purple") +
  ggplot2::annotate("point", x = 515, y = 260, size = 10) +
  ggplot2::labs(
    title = "This is a ggplot!",
    caption = "Made with webmorphR"
  )

webmorphR documentation built on June 2, 2022, 5:07 p.m.