View source: R/draw_annotations.R
| draw_annotations | R Documentation |
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.
draw_annotations(annotations_data, zoom_level = 1)
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 |
ggplot2 annotation layers
library(ggplot2)
annotations_data <- data.frame(
text = 'x1', x = 9.5, y = 21, font = 'sans',
size = 16, color = '#FFFFFF', fill = NA, angle = 0,
alpha = 1, fontface = 'plain', math_expression = FALSE,
lavaan = FALSE, network = FALSE, locked = FALSE,
group_label = FALSE, loop_label = FALSE, group = 1
)
p <- ggplot()
p + draw_annotations(annotations_data, zoom_level = 1.2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.