graphic-devices: Create a group of named graphic devices

Description Usage Arguments Value Examples

Description

Create a group of named graphic devices

Usage

1
2
3

Arguments

...

named expressions to launch devices

env

environment to evaluate expressions

attributes

named list; names correspond to device names and values are attributes to set to the devices

which

which attribute to obtain

dev

which device to search for attributes

ifnotfound

value to return if attribute is not found

Value

A list of functions to query, control, and switch between devices

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
35
36
37
## Not run:  ## Unix-specific example

# Create multiple named devices, setting attributes to the second graph
devs <- dev_create(
  line = X11(), points = x11(),
  attributes = list(points = list(pch = 16))
)

# switch to device named "points"

devs$dev_which('points')

# Plot points, with pch given as preset
plot(1:10, pch = get_dev_attr(which = 'pch', ifnotfound = 1))

# switch to "line" device
devs$dev_switch('line')
plot(1:100, type='l')

# Create another group with conflict name
dev_another <- dev_create(line = X11())

# Query device name with 'line'
dev_another$dev_which('line')  # 4
devs$dev_which('line')  # 2, doesn't conflict with the new groups

dev.list()
# close one or more device
dev_another$dev_off('line')
dev.list()

# close all devices
devs$dev_off()
dev.list()


## End(Not run)

dipsaus documentation built on Sept. 6, 2021, 5:08 p.m.