facet_panel_dimensions | R Documentation |
This function extracts the number if rows and columns of the panel
in a faceted ggplot. It can be used to calculate the width
and height
of a shiny::renderPlot()
facet_panel_dimensions(p)
p |
A ggplot2 object |
Some details here :)
A named list of the number of $rows and $cols
library(ggplot2) p1 <- ggplot(mtcars, aes(mpg, wt)) + facet_wrap(~ gear ) facet_panel_dimensions(p1) p2 <- ggplot(mtcars, aes(mpg, wt)) + facet_grid(cyl ~ gear ) facet_panel_dimensions(p2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.