Home > Net >  How do I fix the size of multiple ggplot plots?
How do I fix the size of multiple ggplot plots?

Time:01-28

I noticed when combining multiple ggplots, where the values in one are much larger than the other, because the y axis ticks are larger in the former (due to being bigger numbers), it makes the plot itself smaller. To illustrate:

df <- data.frame('name'=1:30,'v1'=rpois(30, 1),'v2'=rpois(30, 100))
p1 <- ggplot(data=df,aes(x=name,y=v1))   geom_bar(stat = 'identity')
p2 <- ggplot(data=df,aes(x=name,y=v2))   geom_bar(stat = 'identity')
combined <- ggarrange(p1, p2, ncol=1, nrow=2)
print(combined)

enter image description here

  •  Tags:  
  • Related