quartz.png: Save as PNG

Description Usage Arguments Value Examples

View source: R/quartz.png.R

Description

Save the contents of the current Quartz window as PNG file

Usage

1
quartz.png(file = "%Y%m%d_%H", width = 550, dir, force = FALSE)

Arguments

file

file name. If it contains any "%" it is passed on as a format string to format(Sys.time(), file). A .png file extension is added automatically.

width

pixel width of the PNG file

dir

directory to save to. Defaults to current working directory

force

force overwriting of existing file with same name. By default duplicate path names are resolved by appending _N, using successive integers, to the end of the file name.

Value

A PNG file is written to disk and a message is written to the console, giving the new file's path and pixel dimensions. The file path is also returned invisibly.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
## Not run: 
set.seed(1)
i_h100 <- round(runif(100, 2, 30), 2)
i_cd <- rexp(100, 1/i_h100)
mydata <- data.frame(i_cd, i_h100)

mydata$i_h100_2m <- cut(mydata$i_h100, seq(2, 30, by=2))

i_cd_2m <- aggregate(i_cd ~ i_h100_2m, mydata, mean)

set_mar(x=2.5)
plot.default(i_cd_2m, xaxt="n", main="Groupwise means", xlab="", cex.main=1)
axis(1, i_cd_2m[,1], as.character(i_cd_2m[,1]), cex.axis=0.6, las=2)

quartz.png()
p <- quartz.png("test", 550)
file.info(p)

## End(Not run)

AkselA/R-ymse documentation built on March 21, 2020, 9:52 a.m.