Skip to content

Commit 47dc611

Browse files
author
Sebastian Kopf
committed
ggsave documentation updated for parameter ext
roxygenized
1 parent 6534a6d commit 47dc611

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

R/save.r

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#' @param filename file name/filename of plot
1313
#' @param plot plot to save, defaults to last plot displayed
1414
#' @param device device to use, automatically extract from file name extension
15+
#' (or from paramter \code{ext} if specified)
1516
#' @param path path to save plot to (if you just want to set path and not
1617
#' filename)
1718
#' @param scale scaling factor
@@ -22,6 +23,9 @@
2223
#' @param limitsize when \code{TRUE} (the default), \code{ggsave} will not
2324
#' save images larger than 50x50 inches, to prevent the common error of
2425
#' specifying dimensions in pixels.
26+
#' @param ext file extension to use for choosing the correct device (pdf, jpg, png, etc.),
27+
#' uses extension of the filename by default, specify if filename does not have
28+
#' an instructive extension (or none at all, e.g. in a temporary file)
2529
#' @param ... other arguments passed to graphics device
2630
#' @export
2731
#' @examples

man/ggsave.Rd

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,18 @@
44
\title{Save a ggplot with sensible defaults}
55
\usage{
66
ggsave(filename = default_name(plot), plot = last_plot(),
7-
device = default_device(filename), path = NULL, scale = 1,
7+
device = default_device(ext), path = NULL, scale = 1,
88
width = par("din")[1], height = par("din")[2], units = c("in", "cm",
9-
"mm"), dpi = 300, limitsize = TRUE, ...)
9+
"mm"), dpi = 300, limitsize = TRUE, ext = default_ext(filename), ...)
1010
}
1111
\arguments{
1212
\item{filename}{file name/filename of plot}
1313

1414
\item{plot}{plot to save, defaults to last plot displayed}
1515

16-
\item{device}{device to use, automatically extract from file name extension}
16+
\item{device}{device to use, automatically extract from
17+
file name extension (or from paramter \code{ext} if
18+
specified)}
1719

1820
\item{path}{path to save plot to (if you just want to set path and not
1921
filename)}
@@ -32,7 +34,13 @@ filename)}
3234
save images larger than 50x50 inches, to prevent the common error of
3335
specifying dimensions in pixels.}
3436

35-
\item{...}{other arguments passed to graphics device}
37+
\item{ext}{file extension to use for choosing the correct
38+
device (pdf, jpg, png, etc.), uses extension of the
39+
filename by default, specify if filename does not have an
40+
instructive extension (or none at all, e.g. in a
41+
temporary file)}
42+
43+
\item{...}{other arguments passed to graphics device}
3644
}
3745
\description{
3846
ggsave is a convenient function for saving a plot. It defaults to

0 commit comments

Comments
 (0)