Learn R Programming

plotscale (version 0.1.6)

as.png.default: Convert to PNG by Default

Description

Converts object to PNG. By default, device is scaled by plot size. Device is automatically closed and filename argument is returned.

Usage

# S3 method for default
as.png(x, width = getOption("plotscale_png_width", 3),
  height = getOption("plotscale_png_height", 3), devsize = if (scaled)
  "devsize" else "unscaled", res = getOption("plotscale_res", 300),
  units = "in", scaled = getOption("plotscale_scaled", TRUE),
  filename = "Rplot%03d.png", ...)

Arguments

x

object

width

desired plot width

height

desired plot height

devsize

a function of x, width, height, and … that calculates device size

res

passed to png

units

NOT passed to png; width and height always treated as inches regardless

scaled

whether to rescale width and height by plot size

filename

file name passed to png

...

other arguments to png and devsize

Value

(invisible) the filename argument

See Also

Other as.png: as.png

Other devices: as.pdf.default, as.pdf, as.png

Examples

Run this code
# NOT RUN {
options(example.ask = FALSE)
options(device.ask.default = FALSE)
library(lattice)
as.png(xyplot(2~3), filename = tempfile())
# }

Run the code above in your browser using DataLab