Save a plot or list of plots
ggsave(
filename,
plot = ggplot2::last_plot(),
device = NULL,
path = NULL,
scale = 1,
width = NA,
height = NA,
units = c("in", "cm", "mm", "px"),
dpi = 300,
limitsize = TRUE,
bg = NULL,
create.dir = FALSE,
...
)# S3 method for gglist
ggsave(
filename,
plot,
device = NULL,
path = NULL,
scale = 1,
width = NA,
height = NA,
units = c("in", "cm", "mm", "px"),
dpi = 300,
limitsize = TRUE,
bg = NULL,
create.dir = FALSE,
...
)
# S3 method for ggtibble
ggsave(
filename,
plot,
device = NULL,
path = NULL,
scale = 1,
width = NA,
height = NA,
units = c("in", "cm", "mm", "px"),
dpi = 300,
limitsize = TRUE,
bg = NULL,
create.dir = FALSE,
...
)
A character string passed to glue::glue_data()
to generate
file names for each row in plot
.
Plot to save, defaults to last plot displayed.
Device to use. Can either be a device function
(e.g. png), or one of "eps", "ps", "tex" (pictex),
"pdf", "jpeg", "tiff", "png", "bmp", "svg" or "wmf" (windows only). If
NULL
(default), the device is guessed based on the filename
extension.
Path of the directory to save plot to: path
and filename
are combined to create the fully qualified file name. Defaults to the
working directory.
Multiplicative scaling factor.
Plot size in units expressed by the units
argument.
If not supplied, uses the size of the current graphics device.
One of the following units in which the width
and height
arguments are expressed: "in"
, "cm"
, "mm"
or "px"
.
Plot resolution. Also accepts a string input: "retina" (320), "print" (300), or "screen" (72). Only applies when converting pixel units, as is typical for raster output types.
When TRUE
(the default), ggsave()
will not
save images larger than 50x50 inches, to prevent the common error of
specifying dimensions in pixels.
Background colour. If NULL
, uses the plot.background
fill value
from the plot theme.
Whether to create new directories if a non-existing
directory is specified in the filename
or path
(TRUE
) or return an
error (FALSE
, default). If FALSE
and run in an interactive session,
a prompt will appear asking to create a new directory when necessary.
Other arguments passed on to the graphics device function,
as specified by device
.
ggsave(gglist)
: Save the figures in a gglist
object
ggsave(ggtibble)
: Save the figures in a ggtibble
object