1

I just recently upgraded to R version 4.1.1 (from 3.6.3) and I noticed the following weird behaviour of flexdashboard:

I have a dashboard, where I plot multiple ggplots on one page (this number changes, so i do this with a loop), similarly as in the reproducible example below.


---
title: "My Reproducible Example"
output: 
flexdashboard::flex_dashboard:
orientation: rows
vertical_layout: scroll

---

```{r }
library(ggplot2)

data("mtcars")

plots <- list()

for (i in 1:(ncol(mtcars) - 1)){
plots[[i]] <- ggplot(data = mtcars) + 
  geom_point(aes_q(x = as.name(names(mtcars)[1]),
                   y = as.name(names(mtcars)[1+i])))
}

for (i in 1:length(plots)){
print(plots[[i]])
}
```

When I run this with version 3.6.3 all of these plots are the same size. However, when I run this with version 4.1.1, I get one big plot, then a small plot, a big plot and a small plot, etc.

Is it also possible to create identically sized plots with a loop like this with R version 4.1.1?

shafee
  • 15,566
  • 3
  • 19
  • 47
multi
  • 11
  • 1

0 Answers0