'ggplots in for loop different size output

In my code I use a for loop to plot a graph from three dataframes out of a list.

The pseudo code would look something like this:

for(i in 1:3){

subplot1 <- ggplot(...)
subplot2 <- ggplot(...)

plot <- ggarrange(subplot1, subplot2, ncol = 1, nrow = 2)
}

The problem is that one of the graphs has higher variance on the y-axis and is therefore much narrower than the other two graphs, which look very ugly and stretched. I would like them all to have the same format as in width and height.

Is there a way to re-format the images by saving them in some sort of object and plotting them after running the loop?

If so, how can you customize the image size etc?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source