View source: R/get_grob_component.R
get_grob_component | R Documentation |
Function retrieves a grob component from a ggplot2 plot object.
get_grob_component(a_plot = NULL, component_name = NULL)
a_plot |
A required ggplot2 plot object |
component_name |
A required string that sets the components name |
A list of grob objects
library(ggplot2)
library(ggplotify)
library(grid)
library(RplotterPkg)
mtcars_plot <- ggplot2::ggplot(
data = datasets::mtcars,
) +
ggplot2::geom_point(aes(x = mpg, y = wt, color = cyl), size = 3)
legend_right <- RplotterPkg::get_grob_component(
a_plot = mtcars_plot,
component_name = "guide-box-right"
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.