makeDevice: Generic graphics device creator

Description Usage Arguments Details Examples

View source: R/graphutils.R

Description

An interface that creates graphical devices from a string characterizing the name.

Usage

1
2
makeDevice(dev = "pdf", width = 6, height = 6, ..., dpi = 96,
  pointsize = 16)

Arguments

dev

Character containing device name.

width

Default width

height

Default height

...

Other parameters that will passed on to tghe device function.

dpi

Dots per inche for use in bitmap devices.

pointsize

Default size for plotted text in bitmap devices.

Details

Very often different types of graphics need to be created. It is very annoying to enter all the parameters one at a time. Given the name of the device type and the size, this function returns a function that creates the appropriate device with the correct file extension.

The accepted devices are 'pdf', 'xfig', 'pictex', 'svg', 'wmf', 'postscript' (eps), 'window', 'png', 'jpeg', 'bmp', 'tiff', 'X11', 'quartz'. Default is pdf. For bitmaps the default resolution is 80 dpi.

Examples

1
2
3
4
5
6
7
8
fun <- makeDevice('pdf')
fun('teste')  # Create teste.pdf file.
plot(1:10)
dev.off()
fun <- makeDevice('png')
fun('teste') # Create teste.png file.
plot(1:10)
dev.off()

tunelipt/wutils documentation built on Nov. 5, 2019, 11:01 a.m.