Convenient function to save the last ggplot-figure in high quality for publication.

save_plot(filename, fig = ggplot2::last_plot(), width = 12, height = 9,
dpi = 300, theme = ggplot2::theme_get(), label.color = "black",
label.size = 2.4, axis.textsize = 0.8, axis.titlesize = 0.75,
legend.textsize = 0.6, legend.titlesize = 0.65, legend.itemsize = 0.5)

## Arguments

filename Name of the output file; filename must end with one of the following accepted file types: ".png", ".jpg", ".svg" or ".tif". The plot that should be saved. By default, the last plot is saved. Width of the figure, in centimetres. Height of the figure, in centimetres. Resolution in dpi (dots per inch). Ignored for vector formats, such as ".svg". The default theme to use when saving the plot. Color value for labels (axis, plot, etc.). Fontsize of value labels inside plot area. Fontsize of axis labels. Fontsize of axis titles. Fontsize of legend labels. Fontsize of legend title. Size of legend's item (legend key), in centimetres.

## Note

This is a convenient function with some default settings that should come close to most of the needs for fontsize and scaling in figures when saving them for printing or publishing. It uses cairographics anti-aliasing (see png).

For adjusting plot appearance, see also sjPlot-themes.