0

I have a problem in saving pdf with multiple pages for multiple plots in each page in R with ggboxplot. I DONT KNOW WHY It just put one plot on each page.

pdf("Quantile Plot BRCA (ggboxplot & Line connecting Means)_Notch.pdf", width = 11, height = 6) 
par(mfrow = c(4, 2), mar = c(5, 4, 4, 2) + 0.1)

# 10 plots like the following one:
ggboxplot(testdf, x = "..", y = "...",
          add =  "jitter",
          order = c("0", "0.25", "0.5", "0.75", "1"),   
          ylab = "...", xlab = "...", bxp.errorbar=TRUE, notch=TRUE) +
   stat_summary(fun=mean, colour="red", shape = 16, size=1) + 
   stat_summary(fun=mean, colour="red", geom="line", lty="longdash", lwd =1, aes(group=1)) 

dev.off()
Allan Cameron
  • 147,086
  • 7
  • 49
  • 87
H. Zadeh
  • 1
  • 2
  • The R command `par(mfrow = c(4, 2))` isn't doing anything here. That only works with base R graphics, not grid graphics on which ggplot2 is built. – Allan Cameron Oct 29 '20 at 13:44
  • Thanks for your reply. So how can I solve this problem to get a PDF file with multiple pages, so that each page contain multiple plots? – H. Zadeh Oct 29 '20 at 18:45
  • Hi Maryam did you read the link to the duplicate post? It shows you how to put multiple plots side by side. – Allan Cameron Oct 29 '20 at 19:55

0 Answers0