plotting.devices: Customized plotting devices

Description Usage Arguments Details Value Apple27 Note Author(s)

Description

The jpeg, png or pdf functions are redefined versions of the standard ones implemented in grDevices: - changes the default size rotates the axis labels (las=1)
- pushes the label out an extra line
- saves the filename to an environment variable, so that dev.off() can find it, and open it.
dev.off closes the current device, and opens the newly created image file. The mechanism behind this is via the setting of an environment variable CURRENT.PLOT.FILENAME, which gets set by one of the jpeg, png or pdf functions.

Usage

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
  png(filename = "Rplot%03d.png", width = 1200,
    height = 800, ...)

  jpeg(filename = "Rplot%03d.jpeg", width = 1200,
    height = 800, ...)

  pdf(filename, width = 11.69, height = 8.27,
    onefile = TRUE, version = "1.4", paper = "special",
    do.par = TRUE, bg = "white", ...)

  dev.off(open = capabilities("aqua"))

  png.VGA(filename = "Rplot%03d.png", width = 640,
    height = 480, pointsize = 12, bg = "white", res = NA,
    ...)

  png.SVGA(filename = "Rplot%03d.png", width = 800,
    height = 600, pointsize = 12, bg = "white", res = NA,
    ...)

  png.XGA(filename = "Rplot%03d.png", width = 1024,
    height = 768, pointsize = 12, bg = "white", res = NA,
    ...)

  png.QVGA(filename = "Rplot%03d.png", width = 1280,
    height = 960, pointsize = 12, bg = "white", res = NA,
    ...)

  png.SXGA(filename = "Rplot%03d.png", width = 1400,
    height = 1050, pointsize = 12, bg = "white", res = NA,
    ...)

  png.UXGA(filename = "Rplot%03d.png", width = 1600,
    height = 1200, pointsize = 12, bg = "white", res = NA,
    ...)

  png.QSXGA(filename = "Rplot%03d.png", width = 2048,
    height = 1536, pointsize = 12, bg = "white", res = NA,
    ...)

  png.QXGA(filename = "Rplot%03d.png", width = 2800,
    height = 2100, pointsize = 12, bg = "white", res = NA,
    ...)

  png.QUXGA(filename = "Rplot%03d.png", width = 3200,
    height = 2400, pointsize = 12, bg = "white", res = NA,
    ...)

  png.Apple27(filename = "Rplot%03d.png", width = 2520,
    height = 1340, pointsize = 12, bg = "white", res = NA,
    ...)

  jpeg.VGA(filename = "Rplot%03d.jpeg", width = 640,
    height = 480, pointsize = 12, quality = 75,
    bg = "white", res = NA, ...)

  jpeg.SVGA(filename = "Rplot%03d.jpeg", width = 800,
    height = 600, pointsize = 12, quality = 75,
    bg = "white", res = NA, ...)

  jpeg.XGA(filename = "Rplot%03d.jpeg", width = 1024,
    height = 768, pointsize = 12, quality = 75,
    bg = "white", res = NA, ...)

  jpeg.QVGA(filename = "Rplot%03d.jpeg", width = 1280,
    height = 960, pointsize = 12, quality = 75,
    bg = "white", res = NA, ...)

  jpeg.SXGA(filename = "Rplot%03d.jpeg", width = 1400,
    height = 1050, pointsize = 12, quality = 75,
    bg = "white", res = NA, ...)

  jpeg.UXGA(filename = "Rplot%03d.jpeg", width = 1600,
    height = 1200, pointsize = 12, quality = 75,
    bg = "white", res = NA, ...)

  jpeg.QXGA(filename = "Rplot%03d.jpeg", width = 2048,
    height = 1536, pointsize = 12, quality = 75,
    bg = "white", res = NA, ...)

  jpeg.QSXGA(filename = "Rplot%03d.jpeg", width = 2800,
    height = 2100, pointsize = 12, quality = 75,
    bg = "white", res = NA, ...)

  jpeg.Apple27(filename = "Rplot%03d.jpeg", width = 2520,
    height = 1340, pointsize = 12, quality = 75,
    bg = "white", res = NA, ...)

  jpeg.QUXGA(filename = "Rplot%03d.jpeg", width = 3200,
    height = 2400, pointsize = 12, quality = 75,
    bg = "white", res = NA, ...)

  pdf.A4(file, onefile = TRUE, version = "1.4", ...)

  pdf.A4.portrait(file, onefile = TRUE, version = "1.4",
    ...)

  pdf.A5(file, onefile = TRUE, version = "1.4", ...)

  pdf.Apple27(file, onefile = TRUE, version = "1.4", ...)

Arguments

filename

the name of the output file

width

the width of the device in pixels for jpeg or png, and inches for pdf

height

the height of the device in pixels for jpeg or png, and inches for pdf

...

passed to png, jpeg, pdf from grDevices

onefile

logical: if TRUE (the default) allow multiple figures in one file. If FALSE, generate a file with name containing the page number for each page.

version

a string describing the PDF version that will be required to view the output. This is a minimum, and will be increased (with a warning) if necessary. Defaults to “1.4”, but see ‘Details’ in pdf

paper

the target paper size. The choices are “a4”, “letter”, “legal” (or “us”) and “executive” (and these can be capitalized), or “a4r” and “USr” for rotated (‘landscape’). The default is “special”, which means that the ‘width’ and ‘height’ specify the paper size. A further choice is “default”; if this is selected, the papersize is taken from the option “papersize” if that is set and as “a4” if it is unset or empty. Defaults “special”.

do.par

logical: setup the plotting parameters?

bg

the background color. default = “white”, which overrides the default setting of transparent.

open

logical: open the recent file? Defaults to TRUE if in an interactive session (see interactive)

Details

In addition, there are predefined versions for creating standard sized jpeg / png devices:

VGA 640x480
SVGA 800x600
XGA 1024x768
QVGA 1280x960
SXGA+ 1400x1050
UXGA 1600x1200
QXGA 2048x1536
QSXGA+ 2800x2100
QUXGA 3200x2400
WXGA 1280x800
SXGA 1280x1024
WSXGA+ 1680x1050
WUXGA 1920x1200
QSXGA 2560x2048

See http://www.i386.info/vidres.htm for more info.

In addition there are routines for opening A4 & A5 portrait/landscape pdf & CairoPDF devices.

Value

device opening functions return nothing. dev.off prints the file path and opens the previously opened file if in an interactive session.

Apple27

The png.Apple27, jpeg.Apple27, pdf.Apple27 functions are designed to create images that can be opened in Preview, and will be close to the maximum possible size on an Apple 27" LED Cinema/Thunderbolt Display. Note, Preview doesn't seem to want to automatically fill the entire screen from edge to edge, thus these are the largest sizes that preview is comforable opening at using ‘View > Actual Size’.

Note

i've made the Cairo* etc plots defunct, since i never use them & it's not worth adding the libcairo dependency.

dev.off: default for open is capabilities("aqua"), since this is only true when running locally on a mac. There must be a more precise way of doing this. Note capabilities("X11") seems a logical choice, but this is TRUE with X11 forwarding, when issuing a system("open ...") command will fail.

Author(s)

Mark Cowley, 2009-06-10


drmjc/mjcgraphics documentation built on May 15, 2019, 2:40 p.m.