graphicsDevice: Instantiate Graphics Device implemented with R functions

Description Usage Arguments Value Author(s) References See Also Examples

Description

This is the general function and associated R methods to create a graphics device whose primitive methods are implemented via R functions.

Usage

1
2
graphicsDevice(name, dim = c(1024, 768), col = "black", fill = "transparent",
                ps = 10, ..., funcs = list(...), ipr = rep(1/72.27, 2))

Arguments

name

either the name of the device or a RDevDescMethods-class object. If the latter is suplied, we compute the name by calling the deviceName function and invoking the method corresponding to this type. The resulting name is used in the .Devices list. This name is often a general description of the type of the device, i.e. not a desciption of the particular instance, although it can be as this would make it easier to identify the individual devices in the .Devices list.

dim

a numeric/integer vector giving the width and height of the device.

col

the default/starting drawing color

fill

the default/starting color used to fill rectangles, circles, etc.

ps

the initial point size for the default font

...

zero or more name = value pairs which are used as functions implementing the graphics device methods. The names must (partially) match the slot names of the RDevDescMethods-class class.

funcs

this is an alternative way to specify functions that implement the graphics device methods. We use this when the functions are already in a list and it is akward to specify them via the ... mechanism. This can be

ipr

a numeric vector of length 2 giving the number if inches per raster/pixel for each of the horizontal and vertical dimensions.

Value

An object of class DevDescPtr-class.

Author(s)

Duncan Temple Lang

References

“The R Internals Manual”, R Development Core Team.

See Also

RDevDescMethods-class

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
25
26
27
28
29
30
31
32
33
34
  devFuns = dummyDevice()
  dev = graphicsDevice("MyDummyDevice", funcs = devFuns)
  .Devices

  dev$right
  dev$right = 1000
  dev$bottom = 800

    # All important to get the plot region with adequate margins
    # and basically get anything working.
  dev$ipr = rep(1/72.27, 2)
  dev$right
  dev$ipr

  as(dev, "DevDesc")

  plot(1:10)

  dev.off()

    # warnings are coming from the lack of a return from functions that
    #

  devFuns = dummyDevice(initDevice = function(dev) {
                                        dev$ipr = rep(1/72.27, 2)
                                        dev$cra = rep(c(6, 13)) * 10/12
                                     },
                        GEInitDevice = function(dev) {
                           gedev <- as(dev, "GEDevDescPtr")
                           gedev$recordGraphics = TRUE
                           gedev$ask = TRUE
                         })

  dev = graphicsDevice("MyDummyDevice", funcs = devFuns)

omegahat/RGraphicsDevice documentation built on Jan. 18, 2022, 4:37 a.m.