Save plots to files

Teppo Valtonen · 2023

When creating plots in R, by default, they are not saved to disk. To display a figure outside of R, you have to explicitly save the plot into a file with, for example, the function ggplot2::ggsave() . When saving, you can set the dimensions and resolution of the figure. You can also choose the file format. The default format of the plot is PNG (Portable Network Graphics) but if I would like to make some further adjustments to the plot in, for example, Inkscape, you should choose SVG (Scalable Vector Graphics).

Read the paper · More papers on PaperTik