I need to save all my ggplots (as svg files) with the requirement below: "All images must have a minimum resolution of 300 dpi,width 107 mm".
Thus I specified these arguments with ggsave():
library(tidyverse)
plot <- iris %>%
ggplot() +
geom_density(aes(x = Sepal.Length, fill = Species)) +
scale_x_continuous(breaks = seq(0,10, 0.1))
plot
ggsave(plot, width = 10.7, dpi = 300, unit = "cm", file = "plot.svg")
However, this results in a squished graphic with overlapping text. How can I scale the plot to the requested requirements?
I have tried scaling = 0.5
but how am I meant to guess the correct value for scaling
and the height
as well?
Thanks