ggsave: Save a ggplot (or other grid object) with sensible defaults...

View source: R/save.R

ggsaveR Documentation

Save a ggplot (or other grid object) with sensible defaults (ggtern version)

Description

ggsave() is a convenient function for saving a plot. It defaults to saving the last plot that you displayed, using the size of the current graphics device. It also guesses the type of graphics device from the extension.

Usage

ggsave(
  filename,
  plot = last_plot(),
  device = NULL,
  path = NULL,
  scale = 1,
  width = NA,
  height = NA,
  units = c("in", "cm", "mm"),
  dpi = 300,
  limitsize = TRUE,
  ...
)

Arguments

filename

File name to create on disk.

plot

Plot to save, defaults to last plot displayed.

device

Device to use (function or any of the recognized extensions, e.g. "pdf"). By default, extracted from filename extension. ggsave currently recognises eps/ps, tex (pictex), pdf, jpeg, tiff, png, bmp, svg and wmf (windows only).

path

Path to save plot to (combined with filename).

scale

Multiplicative scaling factor.

width, height

Plot dimensions, defaults to size of current graphics device.

units

Units for width and height when specified explicitly (in, cm, or mm)

dpi

Resolution used for raster outputs.

limitsize

When TRUE (the default), ggsave will not save images larger than 50x50 inches, to prevent the common error of specifying dimensions in pixels.

...

Other arguments passed on to graphics device

Author(s)

Nicholas Hamilton

Examples

## Not run: 
data(Feldspar)
base = ggtern(Feldspar,aes(Ab,An,Or)) + geom_point()
ggsave("./output.pdf",base,width=10,height=10)

## End(Not run)

ggtern documentation built on June 22, 2024, 11:01 a.m.