1

I am currently trying of saving several plots to put them in my word document for presentation. Some bar plots have 4 columns, others have 8. I would like to adapt the size of the bar plots with only 4 or 5 columns, so that they are only have of the width as the bar plots with 8 bars. In other words: In my word document all the plots should have about the same height, where as the width of the plots should vary depending on the number of columns.

I tried to follow the instructions on Set the size of ggsave exactly but I can change the height or width in ggsave() to any number and if I put the saved plots into word it doesn't make any difference.

ggsave(ggsave(file = "plot_9.jpeg",
              plot = plot_9,
              width = 8, height = 9, units = "cm",
              dpi = 300))
ggsave(ggsave(file = "plot_9.jpeg",
              plot = plot_9,
              width = 5, height = 9, units = "cm",
              dpi = 300))

resulting histogram

kjetil b halvorsen
  • 1,206
  • 2
  • 18
  • 28
Laura Aina
  • 11
  • 1
  • * I mean "half of the width" not "have of the width" – Laura Aina May 24 '23 at 10:00
  • Any reason you are wrapping `ggsave` inside another `ggsave`? Using `ggsave(ggsave(...))` will export the last plot using the default settings for width and height. – stefan May 24 '23 at 10:48
  • 1
    Ohhh nooo! That actually is the solution. I looked it over and over and couln't find the mistake. Thank you very much for looking at my question. Silly mistake.. – Laura Aina May 24 '23 at 10:59

0 Answers0