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.size = 2.4,
axis.textsize = 0.8, axis.titlesize = 0.75, legend.textsize = 0.6,
legend.titlesize = 0.65, legend.itemsize = 0.5)
the name of the output file; filename must end with one of the following acceptes file types: ".png", ".jpg", ".svg" or ".tif".
the plot that should be saved. By default, the last plot is saved.
the width of the figure, in centimetres
the height of the figure, in centimetres
resolution in dpi (dots per inch). Ignored for vector formats, such as ".svg".
Name of a pre-set theme. May be one of:
"blank"
a theme with no grids and axes.
"forest"
a theme for forest plots, with no grids, in "539" style.
"538"
a grey-scaled theme inspired by 538-charts, adapted from minimaxir.com.
"539"
a slight modification of the 538-theme.
"scatter"
a theme for scatter plots in 539-theme-style.
"538w"
, "539w"
, "scatterw"
and "forestw"
for themes as described above, however all with white backgrounds.
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.