1

May question is a bit strange. I'll explain you my situation, Maybe someone knows another workaround. Assume I've 5 plots (just for convenience assume that plot 3 and 5 are identical)

library(ggplot2) # This example uses the ChickWeight dataset, which comes with ggplot2 # First plot p1 <- ggplot(ChickWeight, aes(x=Time, y=weight, colour=Diet, group=Chick)) + geom_line() # Second plot p2 <- ggplot(ChickWeight, aes(x=Time, y=weight, colour=Diet)) + geom_point(alpha=.3) + geom_smooth(alpha=.2, size=1) # Third plot p3 <- ggplot(subset(ChickWeight, Time==21), aes(x=weight, colour=Diet)) + geom_density() # Fourth plot p4 <- ggplot(subset(ChickWeight, Time==21), aes(x=weight, fill=Diet)) + geom_histogram(colour="black", binwidth=50) + facet_grid(Diet ~ .) + theme(legend.position="none") # No legend (redundant in this graph) p5 <- p3 multiplot(p1, p2, p3, p4, cols=2) 

I am using the multiplot function to create one picture with 4 subplot. I want know create 2nd "multiplot" with 2 columns but only on graph. However I didnt find a solution to handle it. The backround is that the 4 plots are taking one Din-A4 side. And I dont want to reduce their size to create a multiplot with 5 subplots. Therefore I want to seperate the 4 plots and the one into two figures, but the 5th plot should have the same size as the 4 subplot. Therefore my idea was to create another multiplot with 2 cols but one empty plot. I hope you get my problem

enter image description here

1 Answer 1

1

If you don't strongly rely on coefplot::multiplot() you could use egg::ggarrange() with defined widths. For best results concerning the widths export the plots with e.g. png(). However, the height of the single plot is a bit tricky. To get it right you could add a completely empty plot.

p.empty <- ggplot() + theme_void() png("plot1.png", width = 480, height = 480) egg::ggarrange(p1, p2, p3, p4, ncol=2, widths=c(3, 3)) dev.off() png("plot2.png", width = 480, height = 480) egg::ggarrange(p5, p.empty, p.empty, ncol=2, nrow=2, widths=c(3, 5)) dev.off() 

Note: Second part of argument widths=c(3, 5) is bigger because of the missing legend in the empty plot.

Result

First plot

enter image description here

Second plot

enter image description here

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.