pdfpng | R Documentation |
Create both a pdf
and a png
file with a graph,
with custom size default values.
pdfpng
tries to open the PDF file (through openPDF
)
with SumatraPDF viewer, which does not lock files against being edited.
See sumatraInitialize
for nice Sumatra default settings.
pdfpng(
expr,
file,
pdf = TRUE,
png = TRUE,
overwrite = FALSE,
open = TRUE,
quiet = FALSE,
tracewarnmes = !quiet,
filargs = NULL,
width = 7,
height = 5,
units = "in",
res = 500,
seed = runif(1, -1e+09, 1e+09),
envlevel = 1,
pdfargs = NULL,
pngargs = NULL,
...
)
expr |
Expression creating the plot, can be included in curly braces. |
file |
Character: Filename without pdf/png extension.
Unless overwrite=TRUE, files will not be overwritten, but
"_1" will be appended instead, see |
pdf |
Logical: Create pdf? DEFAULT: TRUE |
png |
Logical: Create png? DEFAULT: TRUE |
overwrite |
Logical: Overwrite existing |
open |
Logical: open file(s) after creation using
|
quiet |
Logical: suppress file creation messages and expr execution error tracing? DEFAULT: FALSE |
tracewarnmes |
Logical: trace warnings and messages in expr execution? Errors are always traced. Default: !quiet |
filargs |
List of other arguments passed to |
width , height |
Graph dimensions. DEFAULT: 7x5 inches |
units , res |
Graph quality arguments passed only to |
seed |
Seed passed to |
envlevel |
Environment level passed to |
pdfargs |
List of arguments only passed to |
pngargs |
List of arguments only passed to |
... |
Further arguments passed to both |
file paths, invisible
Berry Boessenkool, berry-b@gmx.de, March 2017
pdf
, png
## Not run: # excluded from CRAN checks, file opening not wanted
pdfpng( plot(rnorm(500), type="l") , file="dummyplot", png=FALSE)
pdfpng({par(bg=8, las=1); plot(cumsum(rnorm(500)), type="l")},
file="dummyplot", res=100, open=FALSE)
pdfpng({par(bg=8, las=1); plot(cumsum(rnorm(500)), type="l")},
file="dummyplot", overwrite=c(TRUE,FALSE), open=FALSE)
# Nesting of functions is possible:
a <- list( cumsum(rnorm(2000)), cumsum(rnorm(20)) )
pdfpng(plot(a[[1]]), file="dummyplot", overwrite=TRUE, open=FALSE)
bfun <- function(b) pdfpng(plot(b,type="l"), file="dummyplot",
overwrite=TRUE, open=FALSE)
cfun <- function(c) bfun(c)
bfun(a[[1]])
sapply(a, function(d) cfun(d))
pdfpng(plot(-10:100, log="y"), "dummyplot",overwr=TRUE,png=FALSE, open=FALSE)
pdfpng({plot(1); plot(dummyobject)}, "dummyplot", overwrite=TRUE,
png=FALSE, open=FALSE)
unlink("dummyplot.pdf") ; unlink("dummyplot.png") ; unlink("dummyplot_1.png")
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.