Size of saved image
When downloading a graph, you can specify the height and width of the image. For example:
ggplot(mpg, aes(x = cty, fill = class)) +
geom_density()
ggsave("myplot_10_by_10.pdf", width = 10, height = 10)
If you meant 10 centimer instead of inch, you can either:
ggsave("myplot_10_by_10cm.pdf", width = 10/2.54, height = 10/2.54)
ggsave("myplot_10_by_10cm2.pdf", width = 10, height = 10, unit = "cm")
Size of image in knitted document
Getting the size of your image right in the Rmarkdown-file takes some effort. You can find help here, here, and here.
The basics: in the chunks you can specify figure size options within ```r{ }:
For instance, this:
Generates this
And this:
produces this: