draw_lines {ggsem} | R Documentation |
Draw lines from a line CSV File (from ggsem Shiny app) on a ggplot object
Description
This function adds lines onto any ggplot output (including your own plots not created from the ggsem Shiny app).
Usage
draw_lines(p, lines_data, zoom_level = 1, n = 100)
Arguments
p |
A ggplot object |
lines_data |
An object that stores the CSV file containing information about lines from the ggsem Shiny app. |
zoom_level |
A numeric value to control the zoom level of the plot. Default is 1. |
n |
Number of points to be used for interpolation (for gradient lines or curved lines). Default is 100. |
Value
A ggplot object is returned as the function's output.
Examples
library(ggplot2)
lines_data <- data.frame(
x_start = 2, y_start = -2, x_end = 10, y_end = -2, ctrl_x = NA, ctrl_y = NA,
type = 'Straight Line', color = '#000000', end_color = '#cc3d3d', color_type = 'Gradient',
gradient_position = 0.35, width = 1.5, alpha = 1, arrow = FALSE,
arrow_type = NA, arrow_size = NA, two_way = FALSE, lavaan = FALSE,
line_style = 'solid'
)
p <- ggplot(mtcars) + geom_point(aes(mpg, disp))
draw_lines(p, lines_data, zoom_level = 1.2, n = 400)
[Package ggsem version 0.1.2 Index]