Learn R Programming

sjPlot (version 1.8.1)

save_plot: Save ggplot-figure for print publication

Description

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

Usage

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

Arguments

filename
the name of the output file; filename must end with one of the following acceptes file types: ".png", ".jpg" or ".tif".
fig
the plot that should be saved. By default, the last plot is saved.
width
the width of the figure, in centimetres
height
the height of the figure, in centimetres
dpi
resolution in dpi (dots per inch)
theme
specify pre-set themes (see 'Details'). Valid argument for ggplot default-themes are for instance:
  • theme_bw
  • theme_classic
  • theme_grey
  • theme_light
  • theme_linedr
label.size
fontsize of value labels inside plot area
axis.textsize
fontsize of axis labels
axis.titlesize
fontsize of axis titles
legend.textsize
fontsize of legend labels
legend.titlesize
fontsize of legend title