Closed clauswilke closed 5 years ago
The gridGraphics package has now an echoGrob() function that seems to work more reliably than my code in as_grob(): https://github.com/wilkelab/cowplot/blob/ffc3e3c9c49ccad54231ba7d7f438691ad1e8a79/R/as_gtable.R#L82-L88
echoGrob()
as_grob()
It will also make the code simpler.
library(ggplot2) library(cowplot) library(gridGraphics) plotfun <- function() { par(cex = .8) boxplot(mpg ~ cyl, xlab = "cyl", ylab = "mpg", data = mtcars) } g1 <- echoGrob(plotfun) p2 <- ggplot(data = mtcars, aes(factor(cyl), mpg)) + geom_boxplot() plot_grid(g1, p2)
Created on 2019-05-07 by the reprex package (v0.2.1)
The gridGraphics package has now an
echoGrob()
function that seems to work more reliably than my code inas_grob()
: https://github.com/wilkelab/cowplot/blob/ffc3e3c9c49ccad54231ba7d7f438691ad1e8a79/R/as_gtable.R#L82-L88It will also make the code simpler.
Created on 2019-05-07 by the reprex package (v0.2.1)