Closed vnijs closed 7 years ago
print()
is not the right function to draw a gtable. Use grid.draw()
instead.
Forgot about that. Thanks @baptiste!
Related question ... why does arrangeGrob
not show any output in the R-notebook below but grid.arrange does show a plot?
---
title: "R Notebook"
output: html_notebook
---
```{r}
library(ggplot2)
library(gridExtra)
plots <- list()
plots[["p1"]] <- ggplot(mpg, aes(displ, hwy)) + geom_point()
plots[["p2"]] <- ggplot(mpg, aes(displ, hwy)) + geom_line()
arrangeGrob(grobs = plots)
```
```{r}
grid.arrange(grobs = plots)
```
In the R-console I get the following:
In Rstudio trying to knit the following also shows the TableGrob text but when run from the command line in Rstudio I do see the plots in the plots tab. Any idea what might be going on?