Learn R Programming

sjPlot (version 2.3.3)

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 = 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)

Arguments

filename

the name of the output file; filename must end with one of the following acceptes file types: ".png", ".jpg", ".svg" 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). Ignored for vector formats, such as ".svg".

theme

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.

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

legend.itemsize

size of legend's item (legend key), in centimetres.