I was trying to run a code from a year ago that uses recordPlot()
function and then plots it using plot_grid()
from the cowplot package. While the code still works on my old computer with R 4.1.1 using RStudio 2021.09.0 it does not work on my fresh install of R 4.3.1 with the newest RStudio 2023.06.1. Apart from my old code the plot_grid()
does not plot anything from recordPlot()
anymore.
Here is a simple code that works with the older version. It produces two graphs next to each other.
library(cowplot)
plot(1:5, 1:5)
p1 <- recordPlot()
plot(1:10, 1:10)
p2 <- recordPlot()
plot_grid(p1, p2)
However, in the new version it just plots a blank file. Does anybody know where the problem is?
I tried to save the plots in a list and then plot them using plot_grid(plotlist = p)
. But it still produces blank plot.