openDevice: Opens a graphics device based on the filename extension

Description Usage Arguments Value Author(s) Examples

View source: R/openDevice.R

Description

Based on the filename extension, will open plotting device using one of the following graphics functions: postscript, pdf, jpeg, tiff, png, or bmp.

Usage

1
openDevice(fileName, ...)

Arguments

fileName

Character string giving the filename for the graphics output. The following are acceptable filename extensions: ps, pdf, jpg, jpeg, tif, png, or bmp.

...

Named arguments to the device functions listed above. Arguments that do not match are silently ignored.

Value

The graphics device is opened and the filename is invisibly returned.

Author(s)

Landon Sego

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# Open 3 example devices
openDevice("ex1.pdf", height=6, width=12)
plot(1:10, 1:10)

openDevice("ex1.jpg")
plot(1:10, 1:10)

openDevice("ex1.png")
plot(1:10, 1:10)

# List the devices and their filenames
dev.list()
dir(pattern = "ex1")

# Turn each of the 3 devices off
for (i in 1:3) {
  dev.off(dev.list()[length(dev.list())])
}

# Delete the created files
unlink(c("ex1.pdf","ex1.png","ex1.jpg"))

# List the current devices
dev.list()

pnnl/Smisc documentation built on Oct. 18, 2020, 6:18 p.m.