taf.png: PNG Device

View source: R/taf.png.R

taf.pngR Documentation

PNG Device

Description

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

Usage

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

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

to

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

## 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 March 31, 2023, 6:51 p.m.