Debian Codegraph @

man/plotPNG.Rd

raw
1 % Generated by roxygen2: do not edit by hand
2 % Please edit documentation in R/imageutils.R
3 \name{plotPNG}
4 \alias{plotPNG}
5 \title{Capture a plot as a PNG file.}
6 \usage{
7 plotPNG(
8 func,
9 filename = tempfile(fileext = ".png"),
10 width = 400,
11 height = 400,
12 res = 72,
13 ...
14 )
15 }
16 \arguments{
17 \item{func}{A function that generates a plot.}
18
19 \item{filename}{The name of the output file. Defaults to a temp file with
20 extension \code{.png}.}
21
22 \item{width}{Width in pixels.}
23
24 \item{height}{Height in pixels.}
25
26 \item{res}{Resolution in pixels per inch. This value is passed to the
27 graphics device. Note that this affects the resolution of PNG rendering in
28 R; it won't change the actual ppi of the browser.}
29
30 \item{...}{Arguments to be passed through to the graphics device. These can
31 be used to set the width, height, background color, etc.}
32 }
33 \value{
34 A path to the newly generated PNG file.
35 }
36 \description{
37 The PNG graphics device used is determined in the following order:
38 \itemize{
39 \item If the ragg package is installed (and the \code{shiny.useragg} is not
40 set to \code{FALSE}), then use \code{\link[ragg:agg_png]{ragg::agg_png()}}.
41 \item If a quartz device is available (i.e., \code{capabilities("aqua")} is
42 \code{TRUE}), then use \code{png(type = "quartz")}.
43 \item If the Cairo package is installed (and the \code{shiny.usecairo} option
44 is not set to \code{FALSE}), then use \code{\link[Cairo:Cairo]{Cairo::CairoPNG()}}.
45 \item Otherwise, use \code{\link[grDevices:png]{grDevices::png()}}. In this case, Linux and Windows
46 may not antialias some point shapes, resulting in poor quality output.
47 }
48 }
49 \details{
50 A \code{NULL} value provided to \code{width} or \code{height} is ignored (i.e., the
51 default \code{width} or \code{height} of the graphics device is used).
52 }