-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathsave_plot.Rd
50 lines (42 loc) · 982 Bytes
/
save_plot.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
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/save_plot.R
\name{save_plot}
\alias{save_plot}
\title{Save plot}
\usage{
save_plot(
p,
filename,
width = 2400,
height,
units = c("px", "cm", "mm"),
res = 300
)
}
\arguments{
\item{p}{A plot object}
\item{filename}{\code{character} to save plot}
\item{width}{In \code{units}}
\item{height}{In \code{units}. If missing, \code{height} will be scaled to \code{width}
at the golden ratio.}
\item{units}{Units of \code{width} and \code{height}. \code{"px"} — pixels, the default,
\code{"cm"}, or \code{"mm"}. \code{"in"} are not allowed on principle.}
\item{res}{resolution, default 300px}
}
\value{
nothing. Writes a plot to \code{filename}
}
\description{
Single line wrapper to save plot as png
}
\examples{
\dontrun{
lovely_plot <- plot(1:10)
# why use three lines
png("lovely_plot.png")
lovely_plot
dev.off()
#when you could use one
save_plot(p = lovely_plot, "lovely_plot.png")
}
}