wilkelab / cowplot

cowplot: Streamlined Plot Theme and Plot Annotations for ggplot2
https://wilkelab.org/cowplot/
704 stars 84 forks source link

Blank plot using plot_grid with RNotebook #187

Open wided-lbn opened 2 years ago

wided-lbn commented 2 years ago

When using cowplot with RNotebook an additional blank plot is created before the requested plot. For example, the advice given by a member to open a null pdf device when converting plots doesn't work for me.


#See outliers
#par(mfrow=c(2,2))
library(cowplot)
library(ggplot2)
p1 <- plot(mod_final,5)
p2 <- influenceIndexPlot(mod_final,vars="Studentized")
p3 <- influenceIndexPlot(mod_final,vars="hat") 
p4 <- influenceIndexPlot(mod_final,vars="cook")
#grid.arrange(p1, p2, p3, p4, nrow=2, ncol=2)
#plot_grid(p1, p2, p3, p4, align = "v", nrow = 2)
#plot_grid(stud, hat, cook, res, ncol = 2, nrow = 2)
grDevices::pdf(NULL)
p5 <- plot_grid(p1, p2, p3, p4, labels = "AUTO")
grDevices::dev.off()
p5

image

thanks for your help, needing it to reduce a number of pages when submitting a project in pdf