forked from tidyverse/ggplot2
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathggsave.Rd
60 lines (49 loc) · 1.95 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
58
59
% Generated by roxygen2 (4.0.0): do not edit by hand
\name{ggsave}
\alias{ggsave}
\title{Save a ggplot with sensible defaults}
\usage{
ggsave(filename = default_name(plot), plot = last_plot(),
device = default_device(filename), path = NULL, scale = 1,
width = par("din")[1], height = par("din")[2], units = c("in", "cm",
"mm"), dpi = 300, limitsize = TRUE, ...)
}
\arguments{
\item{filename}{file name/filename of plot}
\item{plot}{plot to save, defaults to last plot displayed}
\item{device}{device to use, automatically extract from file name extension}
\item{path}{path to save plot to (if you just want to set path and not
filename)}
\item{scale}{scaling factor}
\item{width}{width (defaults to the width of current plotting window)}
\item{height}{height (defaults to the height of current plotting window)}
\item{units}{units for width and height when either one is explicitly specified (in, cm, or mm)}
\item{dpi}{dpi to use for raster graphics}
\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 to graphics device}
}
\description{
ggsave is a convenient function for saving a plot. It defaults to
saving the last plot that you displayed, and for a default size uses
the size of the current graphics device. It also guesses the type of
graphics device from the extension. This means the only argument you
need to supply is the filename.
}
\details{
\code{ggsave} currently recognises the extensions eps/ps, tex (pictex),
pdf, jpeg, tiff, png, bmp, svg and wmf (windows only).
}
\examples{
\dontrun{
ratings <- qplot(rating, data=movies, geom="histogram")
qplot(length, data=movies, geom="histogram")
ggsave("length-hist.pdf")
ggsave("length-hist.png")
ggsave("ratings.pdf", ratings)
ggsave("ratings.pdf", ratings, width=4, height=4)
# make twice as big as on screen
ggsave("ratings.pdf", ratings, scale=2)
}
}