draw_annotations {ggsem} | R Documentation |
Draw Text Annotations to a ggplot Object
Description
This function overlays text annotations onto any ggplot object. It is particularly useful for adding annotations from CSV files generated by the ggsem Shiny app but can also be used with custom annotation data.
Usage
draw_annotations(p, annotations_data, zoom_level = 1)
Arguments
p |
A ggplot object. The plot to which the annotations will be added. |
annotations_data |
A data frame containing annotation information. Typically, this comes from a CSV file generated by the ggsem Shiny app. The required columns include:
|
zoom_level |
Numeric. Adjusts the size of annotations based on the zoom level. Default is |
Value
A ggplot object with the specified annotations added.
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, network = FALSE, locked = FALSE
)
p <- ggplot()
draw_annotations(p, annotations_data, zoom_level = 1.2)