taf.png: PNG Device

Description Usage Arguments Details Value Note See Also Examples

View source: R/taf.png.R

Description

Open PNG graphics device to export a plot into the TAF report folder.

Usage

1
taf.png(filename, width = 1600, height = 1200, res = 200, ...)

Arguments

filename

plot filename.

width

image width.

height

image height.

res

resolution determining the text size, line width, plot symbol size, etc.

...

passed to png.

Details

The filename can be passed without the preceding "report/", and without the ".png" filename extension.

Specifically, the function prepends "report/" to the filename if (1) the filename does not contain a "/" separator, (2) the working directory is not report, and (3) the directory report exists. The function also appends ".png" to the filename if it does not already have that filename extension.

This automatic filename manipulation can be bypassed by using the png function directly.

Value

No return value, called for side effects.

Note

A simple convenience function to shorten

1
png("report/plot.png", width=1600, height=1200, res=200)

to

1
taf.png("plot")

The res argument affects the text size, along with all other plot elements. To change the text size of specific lattice plot elements, the zoom function can be helpful.

For consistent image width and text size, it can be useful to keep the default width = 1600 but vary the height to adjust the desired aspect ratio for each plot.

See Also

png is the underlying function used to open a PNG graphics device.

zoom changes text size in a lattice plot.

TAF-package gives an overview of the package.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
## Not run: 
taf.png("myplot")
plot(1)
dev.off()

library(lattice)
taf.png("mytrellis")
xyplot(1~1)
dev.off()

library(ggplot2)
taf.png("myggplot")
qplot(1, 1)
dev.off()

## End(Not run)

TAF documentation built on April 7, 2021, 5:06 p.m.