3

I want to create a combined plot with ggarrange and save it as png-file. I tried it with the following code:

png("../graphics/Part1.png", width = 8, height = 20, res=300, units = "cm")
ggarrange(P1, P2, P3, P4, P6,
          ncol = 1, nrow = 5,
          common.legend = TRUE,
          legend = "bottom")
dev.off()

When I open the png the legend is only partly visible, hence it seems to big for the file. How can I cange the size? I tried to create my own theme as it's been recommended here. But it does not seem to change the size.

myTheme <- theme(legend.text = element_text(size = 4), 
                 legend.title = element_text(size = 4), 
                 legend.key.size = unit(0.1, 'cm'),
                 plot.title = element_text(hjust = 0.5, size = 5),
                 axis.title = element_text(size = 4),
                 axis.text = element_text(size = 3),
                 axis.text.x = element_blank(),
                 axis.ticks.x = element_blank())
  • 1
    It's easier to help you if you provide a [reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) with sample input and desired output that can be used to test and verify possible solutions. – MrFlick May 04 '22 at 14:55

0 Answers0