get_grob_component {RplotterPkg} | R Documentation |
get_grob_component
Description
Function retrieves a grob component from a ggplot2 plot object.
Usage
get_grob_component(a_plot = NULL, component_name = NULL)
Arguments
a_plot |
A required ggplot2 plot object |
component_name |
A required string that sets the components name |
Value
A list of grob objects
Examples
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"
)
[Package RplotterPkg version 0.1.3 Index]