forked from tidyverse/ggplot2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathggsave.Rd
58 lines (45 loc) · 1.73 KB
/
ggsave.Rd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
% Generated by roxygen2 (4.1.1): do not edit by hand
% Please edit documentation in R/save.r
\name{ggsave}
\alias{ggsave}
\title{Save a ggplot (or other grid object) with sensible defaults}
\usage{
ggsave(filename, plot = last_plot(), device = default_device(filename),
path = NULL, scale = 1, width = NA, height = NA, units = c("in",
"cm", "mm"), dpi = 300, limitsize = TRUE, ...)
}
\arguments{
\item{filename}{File name to create on disk.}
\item{plot}{Plot to save, defaults to last plot displayed.}
\item{device}{Device to use. By default, extracted from extension.
\code{ggsave} currently recognises eps/ps, tex (pictex), pdf, jpeg, tiff,
png, bmp, svg and wmf (windows only).}
\item{path}{Path to save plot to (combined with filename).}
\item{scale}{Multiplicative scaling factor.}
\item{width,height}{Plot dimensions, defaults to size of current graphics
device.}
\item{units}{Units for width and height when specified explicitly (in, cm,
or mm)}
\item{dpi}{Resolution used for raster outputs.}
\item{limitsize}{When \code{TRUE} (the default), \code{ggsave} will not
save images larger than 50x50 inches, to prevent the common error of
specifying dimensions in pixels.}
\item{...}{Other arguments passed on to graphics device}
}
\description{
\code{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.
}
\examples{
\dontrun{
ggplot(movies, aes(rating)) + geom_histogram(binwidth = 0.1)
ggsave("ratings.pdf")
ggsave("ratings.pdf")
ggsave("ratings.pdf", width = 4, height = 4)
ggsave("ratings.pdf", width = 20, height = 20, units = "cm")
unlink("ratings.pdf")
unlink("ratings.png")
}
}