Skip to contents

This function adds text annotations onto any ggplot output (including your own plots not created from the ggsem Shiny app).

Usage

draw_annotations(p, annotations_data, zoom_level = 1)

Arguments

p

A ggplot2 object

annotations_data

The object that stores the CSV file containing information about text annotations from the ggsem Shiny app.

zoom_level

A numeric value to control the zoom level of the plot. Default is 1.

Value

A ggplot object is returned as the function's output.

Examples

library(ggplot2)

annotations_data <- data.frame(
text = 'Square One', x = 26, y = 300, font = 'serif',
size = 20, color = '#000000', angle = 0, alpha = 1,
fontface = 'bold', math_expression = FALSE,
lavaan = FALSE
)

p <- ggplot(mtcars) + geom_point(aes(mpg, disp))

draw_annotations(p, annotations_data, zoom_level = 1.2)