The R Project SVN R

Rev

Rev 51900 | Rev 52082 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 51900 Rev 52081
Line 1... Line 1...
1
 
1
 
2
R version 2.12.0 Under development (unstable) (2010-05-03 r51899)
2
R version 2.12.0 Under development (unstable) (2010-05-23 r52077)
3
Copyright (C) 2010 The R Foundation for Statistical Computing
3
Copyright (C) 2010 The R Foundation for Statistical Computing
4
ISBN 3-900051-07-0
4
ISBN 3-900051-07-0
5
 
5
Platform: i386-pc-mingw32/i386 (32-bit)
6
R is free software and comes with ABSOLUTELY NO WARRANTY.
6
 
7
You are welcome to redistribute it under certain conditions.
7
R is free software and comes with ABSOLUTELY NO WARRANTY.
8
Type 'license()' or 'licence()' for distribution details.
8
You are welcome to redistribute it under certain conditions.
9
 
9
Type 'license()' or 'licence()' for distribution details.
10
  Natural language support but running in an English locale
10
 
11
 
11
  Natural language support but running in an English locale
12
R is a collaborative project with many contributors.
12
 
13
Type 'contributors()' for more information and
13
R is a collaborative project with many contributors.
14
'citation()' on how to cite R or R packages in publications.
14
Type 'contributors()' for more information and
15
 
15
'citation()' on how to cite R or R packages in publications.
16
Type 'demo()' for some demos, 'help()' for on-line help, or
16
 
17
'help.start()' for an HTML browser interface to help.
17
Type 'demo()' for some demos, 'help()' for on-line help, or
18
Type 'q()' to quit R.
18
'help.start()' for an HTML browser interface to help.
19
 
19
Type 'q()' to quit R.
20
> pkgname <- "grDevices"
20
 
21
> source(file.path(R.home("share"), "R", "examples-header.R"))
21
> pkgname <- "grDevices"
22
> options(warn = 1)
22
> source(file.path(R.home("share"), "R", "examples-header.R"))
23
> library('grDevices')
23
> options(warn = 1)
24
> 
24
> options(pager = "console")
25
> assign(".oldSearch", search(), pos = 'CheckExEnv')
25
> library('grDevices')
26
> cleanEx()
26
> 
27
> nameEx("Devices")
27
> assign(".oldSearch", search(), pos = 'CheckExEnv')
28
> ### * Devices
28
> cleanEx()
29
> 
29
> nameEx("Devices")
30
> flush(stderr()); flush(stdout())
30
> ### * Devices
31
> 
31
> 
32
> ### Name: Devices
32
> flush(stderr()); flush(stdout())
33
> ### Title: List of Graphical Devices
33
> 
34
> ### Aliases: Devices device
34
> ### Name: Devices
35
> ### Keywords: device
35
> ### Title: List of Graphical Devices
36
> 
36
> ### Aliases: Devices device
37
> ### ** Examples
37
> ### Keywords: device
38
> ## Not run: 
38
> 
39
> ##D ## open the default screen device on this platform if no device is
39
> ### ** Examples
40
> ##D ## open
40
> ## Not run: 
41
> ##D if(dev.cur() == 1) dev.new()
41
> ##D ## open the default screen device on this platform if no device is
42
> ## End(Not run)
42
> ##D ## open
43
> 
43
> ##D if(dev.cur() == 1) dev.new()
44
> 
44
> ## End(Not run)
45
> cleanEx()
45
> 
46
> nameEx("Hershey")
46
> 
47
> ### * Hershey
47
> cleanEx()
48
> 
48
> nameEx("Hershey")
49
> flush(stderr()); flush(stdout())
49
> ### * Hershey
50
> 
50
> 
51
> ### Name: Hershey
51
> flush(stderr()); flush(stdout())
52
> ### Title: Hershey Vector Fonts in R
52
> 
53
> ### Aliases: Hershey
53
> ### Name: Hershey
54
> ### Keywords: aplot
54
> ### Title: Hershey Vector Fonts in R
55
> 
55
> ### Aliases: Hershey
56
> ### ** Examples
56
> ### Keywords: aplot
57
> 
57
> 
58
> Hershey
58
> ### ** Examples
59
$typeface
59
> 
60
[1] "serif"             "sans serif"        "script"           
60
> Hershey
61
[4] "gothic english"    "gothic german"     "gothic italian"   
61
$typeface
62
[7] "serif symbol"      "sans serif symbol"
62
[1] "serif"             "sans serif"        "script"           
63
 
63
[4] "gothic english"    "gothic german"     "gothic italian"   
64
$fontindex
64
[7] "serif symbol"      "sans serif symbol"
65
[1] "plain"            "italic"           "bold"             "bold italic"     
65
 
66
[5] "cyrillic"         "oblique cyrillic" "EUC"             
66
$fontindex
67
 
67
[1] "plain"            "italic"           "bold"             "bold italic"     
68
$allowed
68
[5] "cyrillic"         "oblique cyrillic" "EUC"             
69
      [,1] [,2]
69
 
70
 [1,]    1    1
70
$allowed
71
 [2,]    1    2
71
      [,1] [,2]
72
 [3,]    1    3
72
 [1,]    1    1
73
 [4,]    1    4
73
 [2,]    1    2
74
 [5,]    1    5
74
 [3,]    1    3
75
 [6,]    1    6
75
 [4,]    1    4
76
 [7,]    1    7
76
 [5,]    1    5
77
 [8,]    2    1
77
 [6,]    1    6
78
 [9,]    2    2
78
 [7,]    1    7
79
[10,]    2    3
79
 [8,]    2    1
80
[11,]    2    4
80
 [9,]    2    2
81
[12,]    3    1
81
[10,]    2    3
82
[13,]    3    2
82
[11,]    2    4
83
[14,]    3    3
83
[12,]    3    1
84
[15,]    4    1
84
[13,]    3    2
85
[16,]    5    1
85
[14,]    3    3
86
[17,]    6    1
86
[15,]    4    1
87
[18,]    7    1
87
[16,]    5    1
88
[19,]    7    2
88
[17,]    6    1
89
[20,]    7    3
89
[18,]    7    1
90
[21,]    7    4
90
[19,]    7    2
91
[22,]    8    1
91
[20,]    7    3
92
[23,]    8    2
92
[21,]    7    4
93
 
93
[22,]    8    1
94
> 
94
[23,]    8    2
95
> ## for tables of examples, see demo(Hershey)
95
 
96
> 
96
> 
97
> 
97
> ## for tables of examples, see demo(Hershey)
98
> 
98
> 
99
> cleanEx()
99
> 
100
> nameEx("Japanese")
100
> 
101
> ### * Japanese
101
> cleanEx()
102
> 
102
> nameEx("Japanese")
103
> flush(stderr()); flush(stdout())
103
> ### * Japanese
104
> 
104
> 
105
> ### Name: Japanese
105
> flush(stderr()); flush(stdout())
106
> ### Title: Japanese characters in R
106
> 
107
> ### Aliases: Japanese
107
> ### Name: Japanese
108
> ### Keywords: aplot
108
> ### Title: Japanese characters in R
109
> 
109
> ### Aliases: Japanese
110
> ### ** Examples
110
> ### Keywords: aplot
111
> 
111
> 
112
> require(graphics)
112
> ### ** Examples
113
> 
113
> 
114
> plot(1:9, type="n", axes=FALSE, frame=TRUE, ylab="",
114
> require(graphics)
115
+      main= "example(Japanese)", xlab= "using Hershey fonts")
115
> 
116
> par(cex=3)
116
> plot(1:9, type="n", axes=FALSE, frame=TRUE, ylab="",
117
> Vf <- c("serif", "plain")
117
+      main= "example(Japanese)", xlab= "using Hershey fonts")
118
> text(4, 2, "\\#J2438\\#J2421\\#J2451\\#J2473", vfont = Vf)
118
> par(cex=3)
119
> text(4, 4, "\\#J2538\\#J2521\\#J2551\\#J2573", vfont = Vf)
119
> Vf <- c("serif", "plain")
120
> text(4, 6, "\\#J467c\\#J4b5c", vfont = Vf)
120
> text(4, 2, "\\#J2438\\#J2421\\#J2451\\#J2473", vfont = Vf)
121
> text(4, 8, "Japan", vfont = Vf)
121
> text(4, 4, "\\#J2538\\#J2521\\#J2551\\#J2573", vfont = Vf)
122
> par(cex=1)
122
> text(4, 6, "\\#J467c\\#J4b5c", vfont = Vf)
123
> text(8, 2, "Hiragana")
123
> text(4, 8, "Japan", vfont = Vf)
124
> text(8, 4, "Katakana")
124
> par(cex=1)
125
> text(8, 6, "Kanji")
125
> text(8, 2, "Hiragana")
126
> text(8, 8, "English")
126
> text(8, 4, "Katakana")
127
> 
127
> text(8, 6, "Kanji")
128
> 
128
> text(8, 8, "English")
129
> 
129
> 
130
> graphics::par(get("par.postscript", pos = 'CheckExEnv'))
130
> 
131
> cleanEx()
131
> 
132
> nameEx("Type1Font")
132
> graphics::par(get("par.postscript", pos = 'CheckExEnv'))
133
> ### * Type1Font
133
> cleanEx()
134
> 
134
> nameEx("Type1Font")
135
> flush(stderr()); flush(stdout())
135
> ### * Type1Font
136
> 
136
> 
137
> ### Name: Type1Font
137
> flush(stderr()); flush(stdout())
138
> ### Title: Type 1 and CID Fonts
138
> 
139
> ### Aliases: Type1Font CIDFont
139
> ### Name: Type1Font
140
> ### Keywords: device
140
> ### Title: Type 1 and CID Fonts
141
> 
141
> ### Aliases: Type1Font CIDFont
142
> ### ** Examples
142
> ### Keywords: device
143
> 
143
> 
144
> ## This duplicates "ComputerModernItalic".
144
> ### ** Examples
145
> CMitalic <- Type1Font("ComputerModern2",
145
> 
146
+                       c("CM_regular_10.afm", "CM_boldx_10.afm",
146
> ## This duplicates "ComputerModernItalic".
147
+                         "cmti10.afm", "cmbxti10.afm",
147
> CMitalic <- Type1Font("ComputerModern2",
148
+                         "CM_symbol_10.afm"),
148
+                       c("CM_regular_10.afm", "CM_boldx_10.afm",
149
+                       encoding = "TeXtext.enc")
149
+                         "cmti10.afm", "cmbxti10.afm",
150
> 
150
+                         "CM_symbol_10.afm"),
151
> ## Not run: 
151
+                       encoding = "TeXtext.enc")
152
> ##D ## This could be used by
152
> 
153
> ##D postscript(family = CMitalic)
153
> ## Not run: 
154
> ##D ## or
154
> ##D ## This could be used by
155
> ##D postscriptFonts(CMitalic = CMitalic)  # once in a session
155
> ##D postscript(family = CMitalic)
156
> ##D postscript(family = "CMitalic", encoding = "TeXtext.enc")
156
> ##D ## or
157
> ## End(Not run)
157
> ##D postscriptFonts(CMitalic = CMitalic)  # once in a session
158
> 
158
> ##D postscript(family = "CMitalic", encoding = "TeXtext.enc")
159
> 
159
> ## End(Not run)
160
> cleanEx()
160
> 
161
> nameEx("as.raster")
161
> 
162
> ### * as.raster
162
> cleanEx()
163
> 
163
> nameEx("as.raster")
164
> flush(stderr()); flush(stdout())
164
> ### * as.raster
165
> 
165
> 
166
> ### Name: as.raster
166
> flush(stderr()); flush(stdout())
167
> ### Title: Create a Raster Object
167
> 
168
> ### Aliases: is.raster as.raster as.raster.logical as.raster.numeric
168
> ### Name: as.raster
169
> ###   as.raster.character as.raster.matrix as.raster.array
169
> ### Title: Create a Raster Object
170
> ### Keywords: dplot
170
> ### Aliases: is.raster as.raster as.raster.logical as.raster.numeric
171
> 
171
> ###   as.raster.character as.raster.matrix as.raster.array
172
> ### ** Examples
172
> ### Keywords: dplot
173
> 
173
> 
174
> # A red gradient
174
> ### ** Examples
175
> as.raster(matrix(hcl(0, 80, seq(50, 80, 10)),
175
> 
176
+                  nrow=4, ncol=5))
176
> # A red gradient
177
     [,1]      [,2]      [,3]      [,4]      [,5]     
177
> as.raster(matrix(hcl(0, 80, seq(50, 80, 10)),
178
[1,] "#C54E6D" "#C54E6D" "#C54E6D" "#C54E6D" "#C54E6D"
178
+                  nrow=4, ncol=5))
179
[2,] "#E16A86" "#E16A86" "#E16A86" "#E16A86" "#E16A86"
179
     [,1]      [,2]      [,3]      [,4]      [,5]     
180
[3,] "#FE86A1" "#FE86A1" "#FE86A1" "#FE86A1" "#FE86A1"
180
[1,] "#C54E6D" "#C54E6D" "#C54E6D" "#C54E6D" "#C54E6D"
181
[4,] "#FFA2BC" "#FFA2BC" "#FFA2BC" "#FFA2BC" "#FFA2BC"
181
[2,] "#E16A86" "#E16A86" "#E16A86" "#E16A86" "#E16A86"
182
> 
182
[3,] "#FE86A1" "#FE86A1" "#FE86A1" "#FE86A1" "#FE86A1"
183
> # Vectors are 1-column matrices ...
183
[4,] "#FFA2BC" "#FFA2BC" "#FFA2BC" "#FFA2BC" "#FFA2BC"
184
> #   character vectors are color names ...
184
> 
185
> as.raster(hcl(0, 80, seq(50, 80, 10)))
185
> # Vectors are 1-column matrices ...
186
     [,1]     
186
> #   character vectors are color names ...
187
[1,] "#C54E6D"
187
> as.raster(hcl(0, 80, seq(50, 80, 10)))
188
[2,] "#E16A86"
188
     [,1]     
189
[3,] "#FE86A1"
189
[1,] "#C54E6D"
190
[4,] "#FFA2BC"
190
[2,] "#E16A86"
191
> #   numeric vectors are greyscale ...
191
[3,] "#FE86A1"
192
> as.raster(1:5, max=5)
192
[4,] "#FFA2BC"
193
     [,1]     
193
> #   numeric vectors are greyscale ...
194
[1,] "#333333"
194
> as.raster(1:5, max=5)
195
[2,] "#666666"
195
     [,1]     
196
[3,] "#999999"
196
[1,] "#333333"
197
[4,] "#CCCCCC"
197
[2,] "#666666"
198
[5,] "#FFFFFF"
198
[3,] "#999999"
199
> #   locigal vectors are black and white ...
199
[4,] "#CCCCCC"
200
> as.raster(1:10 %% 2 == 0)
200
[5,] "#FFFFFF"
201
      [,1]     
201
> #   locigal vectors are black and white ...
202
 [1,] "#000000"
202
> as.raster(1:10 %% 2 == 0)
203
 [2,] "#FFFFFF"
203
      [,1]     
204
 [3,] "#000000"
204
 [1,] "#000000"
205
 [4,] "#FFFFFF"
205
 [2,] "#FFFFFF"
206
 [5,] "#000000"
206
 [3,] "#000000"
207
 [6,] "#FFFFFF"
207
 [4,] "#FFFFFF"
208
 [7,] "#000000"
208
 [5,] "#000000"
209
 [8,] "#FFFFFF"
209
 [6,] "#FFFFFF"
210
 [9,] "#000000"
210
 [7,] "#000000"
211
[10,] "#FFFFFF"
211
 [8,] "#FFFFFF"
212
> 
212
 [9,] "#000000"
213
> # ... unless nrow/ncol are supplied ...
213
[10,] "#FFFFFF"
214
> as.raster(1:10 %% 2 == 0, nrow=1)
214
> 
215
     [,1]      [,2]      [,3]      [,4]      [,5]      [,6]      [,7]     
215
> # ... unless nrow/ncol are supplied ...
216
[1,] "#000000" "#FFFFFF" "#000000" "#FFFFFF" "#000000" "#FFFFFF" "#000000"
216
> as.raster(1:10 %% 2 == 0, nrow=1)
217
     [,8]      [,9]      [,10]    
217
     [,1]      [,2]      [,3]      [,4]      [,5]      [,6]      [,7]     
218
[1,] "#FFFFFF" "#000000" "#FFFFFF"
218
[1,] "#000000" "#FFFFFF" "#000000" "#FFFFFF" "#000000" "#FFFFFF" "#000000"
219
> 
219
     [,8]      [,9]      [,10]    
220
> # Matrix can also be logical or numeric ...
220
[1,] "#FFFFFF" "#000000" "#FFFFFF"
221
> as.raster(matrix(c(TRUE, FALSE), nrow=3, ncol=2))
221
> 
222
     [,1]      [,2]     
222
> # Matrix can also be logical or numeric ...
223
[1,] "#FFFFFF" "#000000"
223
> as.raster(matrix(c(TRUE, FALSE), nrow=3, ncol=2))
224
[2,] "#000000" "#FFFFFF"
224
     [,1]      [,2]     
225
[3,] "#FFFFFF" "#000000"
225
[1,] "#FFFFFF" "#000000"
226
> as.raster(matrix(1:3/4, nrow=3, ncol=4))
226
[2,] "#000000" "#FFFFFF"
227
     [,1]      [,2]      [,3]      [,4]     
227
[3,] "#FFFFFF" "#000000"
228
[1,] "#404040" "#404040" "#404040" "#404040"
228
> as.raster(matrix(1:3/4, nrow=3, ncol=4))
229
[2,] "#808080" "#808080" "#808080" "#808080"
229
     [,1]      [,2]      [,3]      [,4]     
230
[3,] "#BFBFBF" "#BFBFBF" "#BFBFBF" "#BFBFBF"
230
[1,] "#404040" "#404040" "#404040" "#404040"
231
> 
231
[2,] "#808080" "#808080" "#808080" "#808080"
232
> # An array can be 3-plane numeric (R, G, B planes) ...
232
[3,] "#BFBFBF" "#BFBFBF" "#BFBFBF" "#BFBFBF"
233
> as.raster(array(c(0:1, rep(0.5, 4)), c(2, 1, 3)))
233
> 
234
     [,1]     
234
> # An array can be 3-plane numeric (R, G, B planes) ...
235
[1,] "#008080"
235
> as.raster(array(c(0:1, rep(0.5, 4)), c(2, 1, 3)))
236
[2,] "#FF8080"
236
     [,1]     
237
> 
237
[1,] "#008080"
238
> # ... or 4-plane numeric (R, G, B, A planes)
238
[2,] "#FF8080"
239
> as.raster(array(c(0:1, rep(0.5, 6)), c(2, 1, 4)))
239
> 
240
     [,1]       
240
> # ... or 4-plane numeric (R, G, B, A planes)
241
[1,] "#00808080"
241
> as.raster(array(c(0:1, rep(0.5, 6)), c(2, 1, 4)))
242
[2,] "#FF808080"
242
     [,1]       
243
> 
243
[1,] "#00808080"
244
> 
244
[2,] "#FF808080"
245
> 
245
> 
246
> 
246
> 
247
> cleanEx()
247
> 
248
> nameEx("boxplot.stats")
248
> 
249
> ### * boxplot.stats
249
> cleanEx()
250
> 
250
> nameEx("boxplot.stats")
251
> flush(stderr()); flush(stdout())
251
> ### * boxplot.stats
252
> 
252
> 
253
> ### Name: boxplot.stats
253
> flush(stderr()); flush(stdout())
254
> ### Title: Box Plot Statistics
254
> 
255
> ### Aliases: boxplot.stats
255
> ### Name: boxplot.stats
256
> ### Keywords: dplot
256
> ### Title: Box Plot Statistics
257
> 
257
> ### Aliases: boxplot.stats
258
> ### ** Examples
258
> ### Keywords: dplot
259
> 
259
> 
260
> require(stats)
260
> ### ** Examples
261
> x <- c(1:100, 1000)
261
> 
262
> (b1 <- boxplot.stats(x))
262
> require(stats)
263
$stats
263
> x <- c(1:100, 1000)
264
[1]   1  26  51  76 100
264
> (b1 <- boxplot.stats(x))
265
 
265
$stats
266
$n
266
[1]   1  26  51  76 100
267
[1] 101
267
 
268
 
268
$n
269
$conf
269
[1] 101
270
[1] 43.13921 58.86079
270
 
271
 
271
$conf
272
$out
272
[1] 43.13921 58.86079
273
[1] 1000
273
 
274
 
274
$out
275
> (b2 <- boxplot.stats(x, do.conf=FALSE, do.out=FALSE))
275
[1] 1000
276
$stats
276
 
277
[1]   1  26  51  76 100
277
> (b2 <- boxplot.stats(x, do.conf=FALSE, do.out=FALSE))
278
 
278
$stats
279
$n
279
[1]   1  26  51  76 100
280
[1] 101
280
 
281
 
281
$n
282
$conf
282
[1] 101
283
NULL
283
 
284
 
284
$conf
285
$out
285
NULL
286
numeric(0)
286
 
287
 
287
$out
288
> stopifnot(b1 $ stats == b2 $ stats) # do.out=F is still robust
288
numeric(0)
289
> boxplot.stats(x, coef = 3, do.conf=FALSE)
289
 
290
$stats
290
> stopifnot(b1 $ stats == b2 $ stats) # do.out=F is still robust
291
[1]   1  26  51  76 100
291
> boxplot.stats(x, coef = 3, do.conf=FALSE)
292
 
292
$stats
293
$n
293
[1]   1  26  51  76 100
294
[1] 101
294
 
295
 
295
$n
296
$conf
296
[1] 101
297
NULL
297
 
298
 
298
$conf
299
$out
299
NULL
300
[1] 1000
300
 
301
 
301
$out
302
> ## no outlier treatment:
302
[1] 1000
303
> boxplot.stats(x, coef = 0)
303
 
304
$stats
304
> ## no outlier treatment:
305
[1]    1   26   51   76 1000
305
> boxplot.stats(x, coef = 0)
306
 
306
$stats
307
$n
307
[1]    1   26   51   76 1000
308
[1] 101
308
 
309
 
309
$n
310
$conf
310
[1] 101
311
[1] 43.13921 58.86079
311
 
312
 
312
$conf
313
$out
313
[1] 43.13921 58.86079
314
numeric(0)
314
 
315
 
315
$out
316
> 
316
numeric(0)
317
> boxplot.stats(c(x, NA)) # slight change : n is 101
317
 
318
$stats
318
> 
319
[1]   1  26  51  76 100
319
> boxplot.stats(c(x, NA)) # slight change : n is 101
320
 
320
$stats
321
$n
321
[1]   1  26  51  76 100
322
[1] 101
322
 
323
 
323
$n
324
$conf
324
[1] 101
325
[1] 43.13921 58.86079
325
 
326
 
326
$conf
327
$out
327
[1] 43.13921 58.86079
328
[1] 1000
328
 
329
 
329
$out
330
> (r <- boxplot.stats(c(x, -1:1/0)))
330
[1] 1000
331
$stats
331
 
332
[1]   1.0  25.5  51.0  76.5 100.0
332
> (r <- boxplot.stats(c(x, -1:1/0)))
333
 
333
$stats
334
$n
334
[1]   1.0  25.5  51.0  76.5 100.0
335
[1] 103
335
 
336
 
336
$n
337
$conf
337
[1] 103
338
[1] 43.06022 58.93978
338
 
339
 
339
$conf
340
$out
340
[1] 43.06022 58.93978
341
[1] 1000 -Inf  Inf
341
 
342
 
342
$out
343
> stopifnot(r$out == c(1000, -Inf, Inf))
343
[1] 1000 -Inf  Inf
344
> 
344
 
345
> ## Don't show: 
345
> stopifnot(r$out == c(1000, -Inf, Inf))
346
>  ## Difference between quartiles and hinges :
346
> 
347
>  nn <- 1:17 ;  n4 <- nn %% 4
347
> ## Don't show: 
348
>  hin <- sapply(sapply(nn, seq), function(x) boxplot.stats(x)$stats[c(2,4)])
348
>  ## Difference between quartiles and hinges :
349
>  q13 <- sapply(sapply(nn, seq), quantile, probs = c(1,3)/4, names = FALSE)
349
>  nn <- 1:17 ;  n4 <- nn %% 4
350
>  m <- t(rbind(q13,hin))[, c(1,3,2,4)]
350
>  hin <- sapply(sapply(nn, seq), function(x) boxplot.stats(x)$stats[c(2,4)])
351
>  dimnames(m) <- list(paste(nn), c("q1","lH", "q3","uH"))
351
>  q13 <- sapply(sapply(nn, seq), quantile, probs = c(1,3)/4, names = FALSE)
352
>  stopifnot(m[n4==1, 1:2] == (nn[n4==1] + 3)/4,# quart. = hinge
352
>  m <- t(rbind(q13,hin))[, c(1,3,2,4)]
353
+            m[n4==1, 3:4] == (3*nn[n4==1]+1)/4,
353
>  dimnames(m) <- list(paste(nn), c("q1","lH", "q3","uH"))
354
+            m[,"lH"] == ( (nn+3) %/% 2) / 2,
354
>  stopifnot(m[n4==1, 1:2] == (nn[n4==1] + 3)/4,# quart. = hinge
355
+            m[,"uH"] == ((3*nn+2)%/% 2) / 2)
355
+            m[n4==1, 3:4] == (3*nn[n4==1]+1)/4,
356
>  cm <- noquote(format(m))
356
+            m[,"lH"] == ( (nn+3) %/% 2) / 2,
357
>  cm[m[,2] == m[,1], 2] <- " = "
357
+            m[,"uH"] == ((3*nn+2)%/% 2) / 2)
358
>  cm[m[,4] == m[,3], 4] <- " = "
358
>  cm <- noquote(format(m))
359
>  cm
359
>  cm[m[,2] == m[,1], 2] <- " = "
360
   q1    lH    q3    uH   
360
>  cm[m[,4] == m[,3], 4] <- " = "
361
1   1.00  =     1.00  =   
361
>  cm
362
2   1.25  1.00  1.75  2.00
362
   q1    lH    q3    uH   
363
3   1.50  =     2.50  =   
363
1   1.00  =     1.00  =   
364
4   1.75  1.50  3.25  3.50
364
2   1.25  1.00  1.75  2.00
365
5   2.00  =     4.00  =   
365
3   1.50  =     2.50  =   
366
6   2.25  2.00  4.75  5.00
366
4   1.75  1.50  3.25  3.50
367
7   2.50  =     5.50  =   
367
5   2.00  =     4.00  =   
368
8   2.75  2.50  6.25  6.50
368
6   2.25  2.00  4.75  5.00
369
9   3.00  =     7.00  =   
369
7   2.50  =     5.50  =   
370
10  3.25  3.00  7.75  8.00
370
8   2.75  2.50  6.25  6.50
371
11  3.50  =     8.50  =   
371
9   3.00  =     7.00  =   
372
12  3.75  3.50  9.25  9.50
372
10  3.25  3.00  7.75  8.00
373
13  4.00  =    10.00  =   
373
11  3.50  =     8.50  =   
374
14  4.25  4.00 10.75 11.00
374
12  3.75  3.50  9.25  9.50
375
15  4.50  =    11.50  =   
375
13  4.00  =    10.00  =   
376
16  4.75  4.50 12.25 12.50
376
14  4.25  4.00 10.75 11.00
377
17  5.00  =    13.00  =   
377
15  4.50  =    11.50  =   
378
> ## End Don't show
378
16  4.75  4.50 12.25 12.50
379
> 
379
17  5.00  =    13.00  =   
380
> 
380
> ## End Don't show
381
> 
381
> 
382
> 
382
> 
383
> cleanEx()
383
> 
384
> nameEx("check.options")
384
> 
385
> ### * check.options
385
> cleanEx()
386
> 
386
> nameEx("check.options")
387
> flush(stderr()); flush(stdout())
387
> ### * check.options
388
> 
388
> 
389
> ### Name: check.options
389
> flush(stderr()); flush(stdout())
390
> ### Title: Set Options with Consistency Checks
390
> 
391
> ### Aliases: check.options
391
> ### Name: check.options
392
> ### Keywords: utilities programming
392
> ### Title: Set Options with Consistency Checks
393
> 
393
> ### Aliases: check.options
394
> ### ** Examples
394
> ### Keywords: utilities programming
395
> 
395
> 
396
> (L1 <- list(a=1:3, b=pi, ch="CH"))
396
> ### ** Examples
397
$a
397
> 
398
[1] 1 2 3
398
> (L1 <- list(a=1:3, b=pi, ch="CH"))
399
 
399
$a
400
$b
400
[1] 1 2 3
401
[1] 3.141593
401
 
402
 
402
$b
403
$ch
403
[1] 3.141593
404
[1] "CH"
404
 
405
 
405
$ch
406
> check.options(list(a=0:2), name.opt = "L1")
406
[1] "CH"
407
$a
407
 
408
[1] 0 1 2
408
> check.options(list(a=0:2), name.opt = "L1")
409
 
409
$a
410
$b
410
[1] 0 1 2
411
[1] 3.141593
411
 
412
 
412
$b
413
$ch
413
[1] 3.141593
414
[1] "CH"
414
 
415
 
415
$ch
416
> check.options(NULL, reset = TRUE, name.opt = "L1")
416
[1] "CH"
417
$a
417
 
418
[1] 1 2 3
418
> check.options(NULL, reset = TRUE, name.opt = "L1")
419
 
419
$a
420
$b
420
[1] 1 2 3
421
[1] 3.141593
421
 
422
 
422
$b
423
$ch
423
[1] 3.141593
424
[1] "CH"
424
 
425
 
425
$ch
426
> 
426
[1] "CH"
427
> 
427
 
428
> 
428
> 
429
> cleanEx()
429
> 
430
> nameEx("chull")
430
> 
431
> ### * chull
431
> cleanEx()
432
> 
432
> nameEx("chull")
433
> flush(stderr()); flush(stdout())
433
> ### * chull
434
> 
434
> 
435
> ### Name: chull
435
> flush(stderr()); flush(stdout())
436
> ### Title: Compute Convex Hull of a Set of Points
436
> 
437
> ### Aliases: chull
437
> ### Name: chull
438
> ### Keywords: graphs
438
> ### Title: Compute Convex Hull of a Set of Points
439
> 
439
> ### Aliases: chull
440
> ### ** Examples
440
> ### Keywords: graphs
441
> 
441
> 
442
> require(stats)
442
> ### ** Examples
443
> X <- matrix(rnorm(2000), ncol = 2)
443
> 
444
> chull(X)
444
> require(stats)
445
 [1]  61 442 165 899 697 446 975 656 232 557 938 295 495
445
> X <- matrix(rnorm(2000), ncol = 2)
446
> ## Not run: 
446
> chull(X)
447
> ##D   # Example usage from graphics package
447
 [1]  61 442 165 899 697 446 975 656 232 557 938 295 495
448
> ##D   plot(X, cex = 0.5)
448
> ## Not run: 
449
> ##D   hpts <- chull(X)
449
> ##D   # Example usage from graphics package
450
> ##D   hpts <- c(hpts, hpts[1])
450
> ##D   plot(X, cex = 0.5)
451
> ##D   lines(X[hpts, ])
451
> ##D   hpts <- chull(X)
452
> ## End(Not run)
452
> ##D   hpts <- c(hpts, hpts[1])
453
> 
453
> ##D   lines(X[hpts, ])
454
> 
454
> ## End(Not run)
455
> 
455
> 
456
> cleanEx()
456
> 
457
> nameEx("cm")
457
> 
458
> ### * cm
458
> cleanEx()
459
> 
459
> nameEx("cm")
460
> flush(stderr()); flush(stdout())
460
> ### * cm
461
> 
461
> 
462
> ### Name: cm
462
> flush(stderr()); flush(stdout())
463
> ### Title: Unit Transformation
463
> 
464
> ### Aliases: cm
464
> ### Name: cm
465
> ### Keywords: dplot
465
> ### Title: Unit Transformation
466
> 
466
> ### Aliases: cm
467
> ### ** Examples
467
> ### Keywords: dplot
468
> 
468
> 
469
> cm(1)# = 2.54
469
> ### ** Examples
470
[1] 2.54
470
> 
471
> 
471
> cm(1)# = 2.54
472
> ## Translate *from* cm *to* inches:
472
[1] 2.54
473
> 
473
> 
474
> 10 / cm(1) # -> 10cm  are 3.937 inches
474
> ## Translate *from* cm *to* inches:
475
[1] 3.937008
475
> 
476
> 
476
> 10 / cm(1) # -> 10cm  are 3.937 inches
477
> 
477
[1] 3.937008
478
> 
478
> 
479
> cleanEx()
479
> 
480
> nameEx("col2rgb")
480
> 
481
> ### * col2rgb
481
> cleanEx()
482
> 
482
> nameEx("col2rgb")
483
> flush(stderr()); flush(stdout())
483
> ### * col2rgb
484
> 
484
> 
485
> ### Name: col2rgb
485
> flush(stderr()); flush(stdout())
486
> ### Title: Color to RGB Conversion
486
> 
487
> ### Aliases: col2rgb
487
> ### Name: col2rgb
488
> ### Keywords: color dplot
488
> ### Title: Color to RGB Conversion
489
> 
489
> ### Aliases: col2rgb
490
> ### ** Examples
490
> ### Keywords: color dplot
491
> 
491
> 
492
> col2rgb("peachpuff")
492
> ### ** Examples
493
      [,1]
493
> 
494
red    255
494
> col2rgb("peachpuff")
495
green  218
495
      [,1]
496
blue   185
496
red    255
497
> col2rgb(c(blu = "royalblue", reddish = "tomato")) # names kept
497
green  218
498
      blu reddish
498
blue   185
499
red    65     255
499
> col2rgb(c(blu = "royalblue", reddish = "tomato")) # names kept
500
green 105      99
500
      blu reddish
501
blue  225      71
501
red    65     255
502
> 
502
green 105      99
503
> col2rgb(1:8)# the ones from the palette() :
503
blue  225      71
504
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8]
504
> 
505
red      0  255    0    0    0  255  255  190
505
> col2rgb(1:8)# the ones from the palette() :
506
green    0    0  205    0  255    0  255  190
506
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8]
507
blue     0    0    0  255  255  255    0  190
507
red      0  255    0    0    0  255  255  190
508
> 
508
green    0    0  205    0  255    0  255  190
509
> col2rgb(paste("gold", 1:4, sep=""))
509
blue     0    0    0  255  255  255    0  190
510
      [,1] [,2] [,3] [,4]
510
> 
511
red    255  238  205  139
511
> col2rgb(paste("gold", 1:4, sep=""))
512
green  215  201  173  117
512
      [,1] [,2] [,3] [,4]
513
blue     0    0    0    0
513
red    255  238  205  139
514
> 
514
green  215  201  173  117
515
> col2rgb("#08a0ff")
515
blue     0    0    0    0
516
      [,1]
516
> 
517
red      8
517
> col2rgb("#08a0ff")
518
green  160
518
      [,1]
519
blue   255
519
red      8
520
> ## all three kind of colors mixed :
520
green  160
521
> col2rgb(c(red="red", palette= 1:3, hex="#abcdef"))
521
blue   255
522
      red palette1 palette2 palette3 hex
522
> ## all three kind of colors mixed :
523
red   255        0      255        0 171
523
> col2rgb(c(red="red", palette= 1:3, hex="#abcdef"))
524
green   0        0        0      205 205
524
      red palette1 palette2 palette3 hex
525
blue    0        0        0        0 239
525
red   255        0      255        0 171
526
> 
526
green   0        0        0      205 205
527
> ##-- NON-INTRODUCTORY examples --
527
blue    0        0        0        0 239
528
> 
528
> 
529
> grC <- col2rgb(paste("gray",0:100,sep=""))
529
> ##-- NON-INTRODUCTORY examples --
530
> table(print(diff(grC["red",])))# '2' or '3': almost equidistant
530
> 
531
  [1] 3 2 3 2 3 2 3 2 3 3 2 3 2 3 2 3 2 3 2 3 3 2 3 2 3 2 3 2 3 3 2 3 2 3 2 3 2
531
> grC <- col2rgb(paste("gray",0:100,sep=""))
532
 [38] 3 2 3 3 2 3 2 3 2 3 2 3 2 3 3 2 3 2 3 2 3 2 3 3 2 3 2 3 2 3 2 3 3 2 3 2 3
532
> table(print(diff(grC["red",])))# '2' or '3': almost equidistant
533
 [75] 2 3 2 3 2 3 3 2 3 2 3 2 3 2 3 2 3 3 2 3 2 3 2 3 2 3
533
  [1] 3 2 3 2 3 2 3 2 3 3 2 3 2 3 2 3 2 3 2 3 3 2 3 2 3 2 3 2 3 3 2 3 2 3 2 3 2
534
 
534
 [38] 3 2 3 3 2 3 2 3 2 3 2 3 2 3 3 2 3 2 3 2 3 2 3 3 2 3 2 3 2 3 2 3 3 2 3 2 3
535
 2  3 
535
 [75] 2 3 2 3 2 3 3 2 3 2 3 2 3 2 3 2 3 3 2 3 2 3 2 3 2 3
536
45 55 
536
 
537
> ## The 'named' grays are in between {"slate gray" is not gray, strictly}
537
 2  3 
538
> col2rgb(c(g66="gray66", darkg= "dark gray", g67="gray67",
538
45 55 
539
+           g74="gray74", gray =      "gray", g75="gray75",
539
> ## The 'named' grays are in between {"slate gray" is not gray, strictly}
540
+           g82="gray82", light="light gray", g83="gray83"))
540
> col2rgb(c(g66="gray66", darkg= "dark gray", g67="gray67",
541
      g66 darkg g67 g74 gray g75 g82 light g83
541
+           g74="gray74", gray =      "gray", g75="gray75",
542
red   168   169 171 189  190 191 209   211 212
542
+           g82="gray82", light="light gray", g83="gray83"))
543
green 168   169 171 189  190 191 209   211 212
543
      g66 darkg g67 g74 gray g75 g82 light g83
544
blue  168   169 171 189  190 191 209   211 212
544
red   168   169 171 189  190 191 209   211 212
545
> 
545
green 168   169 171 189  190 191 209   211 212
546
> crgb <- col2rgb(cc <- colors())
546
blue  168   169 171 189  190 191 209   211 212
547
> colnames(crgb) <- cc
547
> 
548
> t(crgb)## The whole table
548
> crgb <- col2rgb(cc <- colors())
549
                     red green blue
549
> colnames(crgb) <- cc
550
white                255   255  255
550
> t(crgb)## The whole table
551
aliceblue            240   248  255
551
                     red green blue
552
antiquewhite         250   235  215
552
white                255   255  255
553
antiquewhite1        255   239  219
553
aliceblue            240   248  255
554
antiquewhite2        238   223  204
554
antiquewhite         250   235  215
555
antiquewhite3        205   192  176
555
antiquewhite1        255   239  219
556
antiquewhite4        139   131  120
556
antiquewhite2        238   223  204
557
aquamarine           127   255  212
557
antiquewhite3        205   192  176
558
aquamarine1          127   255  212
558
antiquewhite4        139   131  120
559
aquamarine2          118   238  198
559
aquamarine           127   255  212
560
aquamarine3          102   205  170
560
aquamarine1          127   255  212
561
aquamarine4           69   139  116
561
aquamarine2          118   238  198
562
azure                240   255  255
562
aquamarine3          102   205  170
563
azure1               240   255  255
563
aquamarine4           69   139  116
564
azure2               224   238  238
564
azure                240   255  255
565
azure3               193   205  205
565
azure1               240   255  255
566
azure4               131   139  139
566
azure2               224   238  238
567
beige                245   245  220
567
azure3               193   205  205
568
bisque               255   228  196
568
azure4               131   139  139
569
bisque1              255   228  196
569
beige                245   245  220
570
bisque2              238   213  183
570
bisque               255   228  196
571
bisque3              205   183  158
571
bisque1              255   228  196
572
bisque4              139   125  107
572
bisque2              238   213  183
573
black                  0     0    0
573
bisque3              205   183  158
574
blanchedalmond       255   235  205
574
bisque4              139   125  107
575
blue                   0     0  255
575
black                  0     0    0
576
blue1                  0     0  255
576
blanchedalmond       255   235  205
577
blue2                  0     0  238
577
blue                   0     0  255
578
blue3                  0     0  205
578
blue1                  0     0  255
579
blue4                  0     0  139
579
blue2                  0     0  238
580
blueviolet           138    43  226
580
blue3                  0     0  205
581
brown                165    42   42
581
blue4                  0     0  139
582
brown1               255    64   64
582
blueviolet           138    43  226
583
brown2               238    59   59
583
brown                165    42   42
584
brown3               205    51   51
584
brown1               255    64   64
585
brown4               139    35   35
585
brown2               238    59   59
586
burlywood            222   184  135
586
brown3               205    51   51
587
burlywood1           255   211  155
587
brown4               139    35   35
588
burlywood2           238   197  145
588
burlywood            222   184  135
589
burlywood3           205   170  125
589
burlywood1           255   211  155
590
burlywood4           139   115   85
590
burlywood2           238   197  145
591
cadetblue             95   158  160
591
burlywood3           205   170  125
592
cadetblue1           152   245  255
592
burlywood4           139   115   85
593
cadetblue2           142   229  238
593
cadetblue             95   158  160
594
cadetblue3           122   197  205
594
cadetblue1           152   245  255
595
cadetblue4            83   134  139
595
cadetblue2           142   229  238
596
chartreuse           127   255    0
596
cadetblue3           122   197  205
597
chartreuse1          127   255    0
597
cadetblue4            83   134  139
598
chartreuse2          118   238    0
598
chartreuse           127   255    0
599
chartreuse3          102   205    0
599
chartreuse1          127   255    0
600
chartreuse4           69   139    0
600
chartreuse2          118   238    0
601
chocolate            210   105   30
601
chartreuse3          102   205    0
602
chocolate1           255   127   36
602
chartreuse4           69   139    0
603
chocolate2           238   118   33
603
chocolate            210   105   30
604
chocolate3           205   102   29
604
chocolate1           255   127   36
605
chocolate4           139    69   19
605
chocolate2           238   118   33
606
coral                255   127   80
606
chocolate3           205   102   29
607
coral1               255   114   86
607
chocolate4           139    69   19
608
coral2               238   106   80
608
coral                255   127   80
609
coral3               205    91   69
609
coral1               255   114   86
610
coral4               139    62   47
610
coral2               238   106   80
611
cornflowerblue       100   149  237
611
coral3               205    91   69
612
cornsilk             255   248  220
612
coral4               139    62   47
613
cornsilk1            255   248  220
613
cornflowerblue       100   149  237
614
cornsilk2            238   232  205
614
cornsilk             255   248  220
615
cornsilk3            205   200  177
615
cornsilk1            255   248  220
616
cornsilk4            139   136  120
616
cornsilk2            238   232  205
617
cyan                   0   255  255
617
cornsilk3            205   200  177
618
cyan1                  0   255  255
618
cornsilk4            139   136  120
619
cyan2                  0   238  238
619
cyan                   0   255  255
620
cyan3                  0   205  205
620
cyan1                  0   255  255
621
cyan4                  0   139  139
621
cyan2                  0   238  238
622
darkblue               0     0  139
622
cyan3                  0   205  205
623
darkcyan               0   139  139
623
cyan4                  0   139  139
624
darkgoldenrod        184   134   11
624
darkblue               0     0  139
625
darkgoldenrod1       255   185   15
625
darkcyan               0   139  139
626
darkgoldenrod2       238   173   14
626
darkgoldenrod        184   134   11
627
darkgoldenrod3       205   149   12
627
darkgoldenrod1       255   185   15
628
darkgoldenrod4       139   101    8
628
darkgoldenrod2       238   173   14
629
darkgray             169   169  169
629
darkgoldenrod3       205   149   12
630
darkgreen              0   100    0
630
darkgoldenrod4       139   101    8
631
darkgrey             169   169  169
631
darkgray             169   169  169
632
darkkhaki            189   183  107
632
darkgreen              0   100    0
633
darkmagenta          139     0  139
633
darkgrey             169   169  169
634
darkolivegreen        85   107   47
634
darkkhaki            189   183  107
635
darkolivegreen1      202   255  112
635
darkmagenta          139     0  139
636
darkolivegreen2      188   238  104
636
darkolivegreen        85   107   47
637
darkolivegreen3      162   205   90
637
darkolivegreen1      202   255  112
638
darkolivegreen4      110   139   61
638
darkolivegreen2      188   238  104
639
darkorange           255   140    0
639
darkolivegreen3      162   205   90
640
darkorange1          255   127    0
640
darkolivegreen4      110   139   61
641
darkorange2          238   118    0
641
darkorange           255   140    0
642
darkorange3          205   102    0
642
darkorange1          255   127    0
643
darkorange4          139    69    0
643
darkorange2          238   118    0
644
darkorchid           153    50  204
644
darkorange3          205   102    0
645
darkorchid1          191    62  255
645
darkorange4          139    69    0
646
darkorchid2          178    58  238
646
darkorchid           153    50  204
647
darkorchid3          154    50  205
647
darkorchid1          191    62  255
648
darkorchid4          104    34  139
648
darkorchid2          178    58  238
649
darkred              139     0    0
649
darkorchid3          154    50  205
650
darksalmon           233   150  122
650
darkorchid4          104    34  139
651
darkseagreen         143   188  143
651
darkred              139     0    0
652
darkseagreen1        193   255  193
652
darksalmon           233   150  122
653
darkseagreen2        180   238  180
653
darkseagreen         143   188  143
654
darkseagreen3        155   205  155
654
darkseagreen1        193   255  193
655
darkseagreen4        105   139  105
655
darkseagreen2        180   238  180
656
darkslateblue         72    61  139
656
darkseagreen3        155   205  155
657
darkslategray         47    79   79
657
darkseagreen4        105   139  105
658
darkslategray1       151   255  255
658
darkslateblue         72    61  139
659
darkslategray2       141   238  238
659
darkslategray         47    79   79
660
darkslategray3       121   205  205
660
darkslategray1       151   255  255
661
darkslategray4        82   139  139
661
darkslategray2       141   238  238
662
darkslategrey         47    79   79
662
darkslategray3       121   205  205
663
darkturquoise          0   206  209
663
darkslategray4        82   139  139
664
darkviolet           148     0  211
664
darkslategrey         47    79   79
665
deeppink             255    20  147
665
darkturquoise          0   206  209
666
deeppink1            255    20  147
666
darkviolet           148     0  211
667
deeppink2            238    18  137
667
deeppink             255    20  147
668
deeppink3            205    16  118
668
deeppink1            255    20  147
669
deeppink4            139    10   80
669
deeppink2            238    18  137
670
deepskyblue            0   191  255
670
deeppink3            205    16  118
671
deepskyblue1           0   191  255
671
deeppink4            139    10   80
672
deepskyblue2           0   178  238
672
deepskyblue            0   191  255
673
deepskyblue3           0   154  205
673
deepskyblue1           0   191  255
674
deepskyblue4           0   104  139
674
deepskyblue2           0   178  238
675
dimgray              105   105  105
675
deepskyblue3           0   154  205
676
dimgrey              105   105  105
676
deepskyblue4           0   104  139
677
dodgerblue            30   144  255
677
dimgray              105   105  105
678
dodgerblue1           30   144  255
678
dimgrey              105   105  105
679
dodgerblue2           28   134  238
679
dodgerblue            30   144  255
680
dodgerblue3           24   116  205
680
dodgerblue1           30   144  255
681
dodgerblue4           16    78  139
681
dodgerblue2           28   134  238
682
firebrick            178    34   34
682
dodgerblue3           24   116  205
683
firebrick1           255    48   48
683
dodgerblue4           16    78  139
684
firebrick2           238    44   44
684
firebrick            178    34   34
685
firebrick3           205    38   38
685
firebrick1           255    48   48
686
firebrick4           139    26   26
686
firebrick2           238    44   44
687
floralwhite          255   250  240
687
firebrick3           205    38   38
688
forestgreen           34   139   34
688
firebrick4           139    26   26
689
gainsboro            220   220  220
689
floralwhite          255   250  240
690
ghostwhite           248   248  255
690
forestgreen           34   139   34
691
gold                 255   215    0
691
gainsboro            220   220  220
692
gold1                255   215    0
692
ghostwhite           248   248  255
693
gold2                238   201    0
693
gold                 255   215    0
694
gold3                205   173    0
694
gold1                255   215    0
695
gold4                139   117    0
695
gold2                238   201    0
696
goldenrod            218   165   32
696
gold3                205   173    0
697
goldenrod1           255   193   37
697
gold4                139   117    0
698
goldenrod2           238   180   34
698
goldenrod            218   165   32
699
goldenrod3           205   155   29
699
goldenrod1           255   193   37
700
goldenrod4           139   105   20
700
goldenrod2           238   180   34
701
gray                 190   190  190
701
goldenrod3           205   155   29
702
gray0                  0     0    0
702
goldenrod4           139   105   20
703
gray1                  3     3    3
703
gray                 190   190  190
704
gray2                  5     5    5
704
gray0                  0     0    0
705
gray3                  8     8    8
705
gray1                  3     3    3
706
gray4                 10    10   10
706
gray2                  5     5    5
707
gray5                 13    13   13
707
gray3                  8     8    8
708
gray6                 15    15   15
708
gray4                 10    10   10
709
gray7                 18    18   18
709
gray5                 13    13   13
710
gray8                 20    20   20
710
gray6                 15    15   15
711
gray9                 23    23   23
711
gray7                 18    18   18
712
gray10                26    26   26
712
gray8                 20    20   20
713
gray11                28    28   28
713
gray9                 23    23   23
714
gray12                31    31   31
714
gray10                26    26   26
715
gray13                33    33   33
715
gray11                28    28   28
716
gray14                36    36   36
716
gray12                31    31   31
717
gray15                38    38   38
717
gray13                33    33   33
718
gray16                41    41   41
718
gray14                36    36   36
719
gray17                43    43   43
719
gray15                38    38   38
720
gray18                46    46   46
720
gray16                41    41   41
721
gray19                48    48   48
721
gray17                43    43   43
722
gray20                51    51   51
722
gray18                46    46   46
723
gray21                54    54   54
723
gray19                48    48   48
724
gray22                56    56   56
724
gray20                51    51   51
725
gray23                59    59   59
725
gray21                54    54   54
726
gray24                61    61   61
726
gray22                56    56   56
727
gray25                64    64   64
727
gray23                59    59   59
728
gray26                66    66   66
728
gray24                61    61   61
729
gray27                69    69   69
729
gray25                64    64   64
730
gray28                71    71   71
730
gray26                66    66   66
731
gray29                74    74   74
731
gray27                69    69   69
732
gray30                77    77   77
732
gray28                71    71   71
733
gray31                79    79   79
733
gray29                74    74   74
734
gray32                82    82   82
734
gray30                77    77   77
735
gray33                84    84   84
735
gray31                79    79   79
736
gray34                87    87   87
736
gray32                82    82   82
737
gray35                89    89   89
737
gray33                84    84   84
738
gray36                92    92   92
738
gray34                87    87   87
739
gray37                94    94   94
739
gray35                89    89   89
740
gray38                97    97   97
740
gray36                92    92   92
741
gray39                99    99   99
741
gray37                94    94   94
742
gray40               102   102  102
742
gray38                97    97   97
743
gray41               105   105  105
743
gray39                99    99   99
744
gray42               107   107  107
744
gray40               102   102  102
745
gray43               110   110  110
745
gray41               105   105  105
746
gray44               112   112  112
746
gray42               107   107  107
747
gray45               115   115  115
747
gray43               110   110  110
748
gray46               117   117  117
748
gray44               112   112  112
749
gray47               120   120  120
749
gray45               115   115  115
750
gray48               122   122  122
750
gray46               117   117  117
751
gray49               125   125  125
751
gray47               120   120  120
752
gray50               127   127  127
752
gray48               122   122  122
753
gray51               130   130  130
753
gray49               125   125  125
754
gray52               133   133  133
754
gray50               127   127  127
755
gray53               135   135  135
755
gray51               130   130  130
756
gray54               138   138  138
756
gray52               133   133  133
757
gray55               140   140  140
757
gray53               135   135  135
758
gray56               143   143  143
758
gray54               138   138  138
759
gray57               145   145  145
759
gray55               140   140  140
760
gray58               148   148  148
760
gray56               143   143  143
761
gray59               150   150  150
761
gray57               145   145  145
762
gray60               153   153  153
762
gray58               148   148  148
763
gray61               156   156  156
763
gray59               150   150  150
764
gray62               158   158  158
764
gray60               153   153  153
765
gray63               161   161  161
765
gray61               156   156  156
766
gray64               163   163  163
766
gray62               158   158  158
767
gray65               166   166  166
767
gray63               161   161  161
768
gray66               168   168  168
768
gray64               163   163  163
769
gray67               171   171  171
769
gray65               166   166  166
770
gray68               173   173  173
770
gray66               168   168  168
771
gray69               176   176  176
771
gray67               171   171  171
772
gray70               179   179  179
772
gray68               173   173  173
773
gray71               181   181  181
773
gray69               176   176  176
774
gray72               184   184  184
774
gray70               179   179  179
775
gray73               186   186  186
775
gray71               181   181  181
776
gray74               189   189  189
776
gray72               184   184  184
777
gray75               191   191  191
777
gray73               186   186  186
778
gray76               194   194  194
778
gray74               189   189  189
779
gray77               196   196  196
779
gray75               191   191  191
780
gray78               199   199  199
780
gray76               194   194  194
781
gray79               201   201  201
781
gray77               196   196  196
782
gray80               204   204  204
782
gray78               199   199  199
783
gray81               207   207  207
783
gray79               201   201  201
784
gray82               209   209  209
784
gray80               204   204  204
785
gray83               212   212  212
785
gray81               207   207  207
786
gray84               214   214  214
786
gray82               209   209  209
787
gray85               217   217  217
787
gray83               212   212  212
788
gray86               219   219  219
788
gray84               214   214  214
789
gray87               222   222  222
789
gray85               217   217  217
790
gray88               224   224  224
790
gray86               219   219  219
791
gray89               227   227  227
791
gray87               222   222  222
792
gray90               229   229  229
792
gray88               224   224  224
793
gray91               232   232  232
793
gray89               227   227  227
794
gray92               235   235  235
794
gray90               229   229  229
795
gray93               237   237  237
795
gray91               232   232  232
796
gray94               240   240  240
796
gray92               235   235  235
797
gray95               242   242  242
797
gray93               237   237  237
798
gray96               245   245  245
798
gray94               240   240  240
799
gray97               247   247  247
799
gray95               242   242  242
800
gray98               250   250  250
800
gray96               245   245  245
801
gray99               252   252  252
801
gray97               247   247  247
802
gray100              255   255  255
802
gray98               250   250  250
803
green                  0   255    0
803
gray99               252   252  252
804
green1                 0   255    0
804
gray100              255   255  255
805
green2                 0   238    0
805
green                  0   255    0
806
green3                 0   205    0
806
green1                 0   255    0
807
green4                 0   139    0
807
green2                 0   238    0
808
greenyellow          173   255   47
808
green3                 0   205    0
809
grey                 190   190  190
809
green4                 0   139    0
810
grey0                  0     0    0
810
greenyellow          173   255   47
811
grey1                  3     3    3
811
grey                 190   190  190
812
grey2                  5     5    5
812
grey0                  0     0    0
813
grey3                  8     8    8
813
grey1                  3     3    3
814
grey4                 10    10   10
814
grey2                  5     5    5
815
grey5                 13    13   13
815
grey3                  8     8    8
816
grey6                 15    15   15
816
grey4                 10    10   10
817
grey7                 18    18   18
817
grey5                 13    13   13
818
grey8                 20    20   20
818
grey6                 15    15   15
819
grey9                 23    23   23
819
grey7                 18    18   18
820
grey10                26    26   26
820
grey8                 20    20   20
821
grey11                28    28   28
821
grey9                 23    23   23
822
grey12                31    31   31
822
grey10                26    26   26
823
grey13                33    33   33
823
grey11                28    28   28
824
grey14                36    36   36
824
grey12                31    31   31
825
grey15                38    38   38
825
grey13                33    33   33
826
grey16                41    41   41
826
grey14                36    36   36
827
grey17                43    43   43
827
grey15                38    38   38
828
grey18                46    46   46
828
grey16                41    41   41
829
grey19                48    48   48
829
grey17                43    43   43
830
grey20                51    51   51
830
grey18                46    46   46
831
grey21                54    54   54
831
grey19                48    48   48
832
grey22                56    56   56
832
grey20                51    51   51
833
grey23                59    59   59
833
grey21                54    54   54
834
grey24                61    61   61
834
grey22                56    56   56
835
grey25                64    64   64
835
grey23                59    59   59
836
grey26                66    66   66
836
grey24                61    61   61
837
grey27                69    69   69
837
grey25                64    64   64
838
grey28                71    71   71
838
grey26                66    66   66
839
grey29                74    74   74
839
grey27                69    69   69
840
grey30                77    77   77
840
grey28                71    71   71
841
grey31                79    79   79
841
grey29                74    74   74
842
grey32                82    82   82
842
grey30                77    77   77
843
grey33                84    84   84
843
grey31                79    79   79
844
grey34                87    87   87
844
grey32                82    82   82
845
grey35                89    89   89
845
grey33                84    84   84
846
grey36                92    92   92
846
grey34                87    87   87
847
grey37                94    94   94
847
grey35                89    89   89
848
grey38                97    97   97
848
grey36                92    92   92
849
grey39                99    99   99
849
grey37                94    94   94
850
grey40               102   102  102
850
grey38                97    97   97
851
grey41               105   105  105
851
grey39                99    99   99
852
grey42               107   107  107
852
grey40               102   102  102
853
grey43               110   110  110
853
grey41               105   105  105
854
grey44               112   112  112
854
grey42               107   107  107
855
grey45               115   115  115
855
grey43               110   110  110
856
grey46               117   117  117
856
grey44               112   112  112
857
grey47               120   120  120
857
grey45               115   115  115
858
grey48               122   122  122
858
grey46               117   117  117
859
grey49               125   125  125
859
grey47               120   120  120
860
grey50               127   127  127
860
grey48               122   122  122
861
grey51               130   130  130
861
grey49               125   125  125
862
grey52               133   133  133
862
grey50               127   127  127
863
grey53               135   135  135
863
grey51               130   130  130
864
grey54               138   138  138
864
grey52               133   133  133
865
grey55               140   140  140
865
grey53               135   135  135
866
grey56               143   143  143
866
grey54               138   138  138
867
grey57               145   145  145
867
grey55               140   140  140
868
grey58               148   148  148
868
grey56               143   143  143
869
grey59               150   150  150
869
grey57               145   145  145
870
grey60               153   153  153
870
grey58               148   148  148
871
grey61               156   156  156
871
grey59               150   150  150
872
grey62               158   158  158
872
grey60               153   153  153
873
grey63               161   161  161
873
grey61               156   156  156
874
grey64               163   163  163
874
grey62               158   158  158
875
grey65               166   166  166
875
grey63               161   161  161
876
grey66               168   168  168
876
grey64               163   163  163
877
grey67               171   171  171
877
grey65               166   166  166
878
grey68               173   173  173
878
grey66               168   168  168
879
grey69               176   176  176
879
grey67               171   171  171
880
grey70               179   179  179
880
grey68               173   173  173
881
grey71               181   181  181
881
grey69               176   176  176
882
grey72               184   184  184
882
grey70               179   179  179
883
grey73               186   186  186
883
grey71               181   181  181
884
grey74               189   189  189
884
grey72               184   184  184
885
grey75               191   191  191
885
grey73               186   186  186
886
grey76               194   194  194
886
grey74               189   189  189
887
grey77               196   196  196
887
grey75               191   191  191
888
grey78               199   199  199
888
grey76               194   194  194
889
grey79               201   201  201
889
grey77               196   196  196
890
grey80               204   204  204
890
grey78               199   199  199
891
grey81               207   207  207
891
grey79               201   201  201
892
grey82               209   209  209
892
grey80               204   204  204
893
grey83               212   212  212
893
grey81               207   207  207
894
grey84               214   214  214
894
grey82               209   209  209
895
grey85               217   217  217
895
grey83               212   212  212
896
grey86               219   219  219
896
grey84               214   214  214
897
grey87               222   222  222
897
grey85               217   217  217
898
grey88               224   224  224
898
grey86               219   219  219
899
grey89               227   227  227
899
grey87               222   222  222
900
grey90               229   229  229
900
grey88               224   224  224
901
grey91               232   232  232
901
grey89               227   227  227
902
grey92               235   235  235
902
grey90               229   229  229
903
grey93               237   237  237
903
grey91               232   232  232
904
grey94               240   240  240
904
grey92               235   235  235
905
grey95               242   242  242
905
grey93               237   237  237
906
grey96               245   245  245
906
grey94               240   240  240
907
grey97               247   247  247
907
grey95               242   242  242
908
grey98               250   250  250
908
grey96               245   245  245
909
grey99               252   252  252
909
grey97               247   247  247
910
grey100              255   255  255
910
grey98               250   250  250
911
honeydew             240   255  240
911
grey99               252   252  252
912
honeydew1            240   255  240
912
grey100              255   255  255
913
honeydew2            224   238  224
913
honeydew             240   255  240
914
honeydew3            193   205  193
914
honeydew1            240   255  240
915
honeydew4            131   139  131
915
honeydew2            224   238  224
916
hotpink              255   105  180
916
honeydew3            193   205  193
917
hotpink1             255   110  180
917
honeydew4            131   139  131
918
hotpink2             238   106  167
918
hotpink              255   105  180
919
hotpink3             205    96  144
919
hotpink1             255   110  180
920
hotpink4             139    58   98
920
hotpink2             238   106  167
921
indianred            205    92   92
921
hotpink3             205    96  144
922
indianred1           255   106  106
922
hotpink4             139    58   98
923
indianred2           238    99   99
923
indianred            205    92   92
924
indianred3           205    85   85
924
indianred1           255   106  106
925
indianred4           139    58   58
925
indianred2           238    99   99
926
ivory                255   255  240
926
indianred3           205    85   85
927
ivory1               255   255  240
927
indianred4           139    58   58
928
ivory2               238   238  224
928
ivory                255   255  240
929
ivory3               205   205  193
929
ivory1               255   255  240
930
ivory4               139   139  131
930
ivory2               238   238  224
931
khaki                240   230  140
931
ivory3               205   205  193
932
khaki1               255   246  143
932
ivory4               139   139  131
933
khaki2               238   230  133
933
khaki                240   230  140
934
khaki3               205   198  115
934
khaki1               255   246  143
935
khaki4               139   134   78
935
khaki2               238   230  133
936
lavender             230   230  250
936
khaki3               205   198  115
937
lavenderblush        255   240  245
937
khaki4               139   134   78
938
lavenderblush1       255   240  245
938
lavender             230   230  250
939
lavenderblush2       238   224  229
939
lavenderblush        255   240  245
940
lavenderblush3       205   193  197
940
lavenderblush1       255   240  245
941
lavenderblush4       139   131  134
941
lavenderblush2       238   224  229
942
lawngreen            124   252    0
942
lavenderblush3       205   193  197
943
lemonchiffon         255   250  205
943
lavenderblush4       139   131  134
944
lemonchiffon1        255   250  205
944
lawngreen            124   252    0
945
lemonchiffon2        238   233  191
945
lemonchiffon         255   250  205
946
lemonchiffon3        205   201  165
946
lemonchiffon1        255   250  205
947
lemonchiffon4        139   137  112
947
lemonchiffon2        238   233  191
948
lightblue            173   216  230
948
lemonchiffon3        205   201  165
949
lightblue1           191   239  255
949
lemonchiffon4        139   137  112
950
lightblue2           178   223  238
950
lightblue            173   216  230
951
lightblue3           154   192  205
951
lightblue1           191   239  255
952
lightblue4           104   131  139
952
lightblue2           178   223  238
953
lightcoral           240   128  128
953
lightblue3           154   192  205
954
lightcyan            224   255  255
954
lightblue4           104   131  139
955
lightcyan1           224   255  255
955
lightcoral           240   128  128
956
lightcyan2           209   238  238
956
lightcyan            224   255  255
957
lightcyan3           180   205  205
957
lightcyan1           224   255  255
958
lightcyan4           122   139  139
958
lightcyan2           209   238  238
959
lightgoldenrod       238   221  130
959
lightcyan3           180   205  205
960
lightgoldenrod1      255   236  139
960
lightcyan4           122   139  139
961
lightgoldenrod2      238   220  130
961
lightgoldenrod       238   221  130
962
lightgoldenrod3      205   190  112
962
lightgoldenrod1      255   236  139
963
lightgoldenrod4      139   129   76
963
lightgoldenrod2      238   220  130
964
lightgoldenrodyellow 250   250  210
964
lightgoldenrod3      205   190  112
965
lightgray            211   211  211
965
lightgoldenrod4      139   129   76
966
lightgreen           144   238  144
966
lightgoldenrodyellow 250   250  210
967
lightgrey            211   211  211
967
lightgray            211   211  211
968
lightpink            255   182  193
968
lightgreen           144   238  144
969
lightpink1           255   174  185
969
lightgrey            211   211  211
970
lightpink2           238   162  173
970
lightpink            255   182  193
971
lightpink3           205   140  149
971
lightpink1           255   174  185
972
lightpink4           139    95  101
972
lightpink2           238   162  173
973
lightsalmon          255   160  122
973
lightpink3           205   140  149
974
lightsalmon1         255   160  122
974
lightpink4           139    95  101
975
lightsalmon2         238   149  114
975
lightsalmon          255   160  122
976
lightsalmon3         205   129   98
976
lightsalmon1         255   160  122
977
lightsalmon4         139    87   66
977
lightsalmon2         238   149  114
978
lightseagreen         32   178  170
978
lightsalmon3         205   129   98
979
lightskyblue         135   206  250
979
lightsalmon4         139    87   66
980
lightskyblue1        176   226  255
980
lightseagreen         32   178  170
981
lightskyblue2        164   211  238
981
lightskyblue         135   206  250
982
lightskyblue3        141   182  205
982
lightskyblue1        176   226  255
983
lightskyblue4         96   123  139
983
lightskyblue2        164   211  238
984
lightslateblue       132   112  255
984
lightskyblue3        141   182  205
985
lightslategray       119   136  153
985
lightskyblue4         96   123  139
986
lightslategrey       119   136  153
986
lightslateblue       132   112  255
987
lightsteelblue       176   196  222
987
lightslategray       119   136  153
988
lightsteelblue1      202   225  255
988
lightslategrey       119   136  153
989
lightsteelblue2      188   210  238
989
lightsteelblue       176   196  222
990
lightsteelblue3      162   181  205
990
lightsteelblue1      202   225  255
991
lightsteelblue4      110   123  139
991
lightsteelblue2      188   210  238
992
lightyellow          255   255  224
992
lightsteelblue3      162   181  205
993
lightyellow1         255   255  224
993
lightsteelblue4      110   123  139
994
lightyellow2         238   238  209
994
lightyellow          255   255  224
995
lightyellow3         205   205  180
995
lightyellow1         255   255  224
996
lightyellow4         139   139  122
996
lightyellow2         238   238  209
997
limegreen             50   205   50
997
lightyellow3         205   205  180
998
linen                250   240  230
998
lightyellow4         139   139  122
999
magenta              255     0  255
999
limegreen             50   205   50
1000
magenta1             255     0  255
1000
linen                250   240  230
1001
magenta2             238     0  238
1001
magenta              255     0  255
1002
magenta3             205     0  205
1002
magenta1             255     0  255
1003
magenta4             139     0  139
1003
magenta2             238     0  238
1004
maroon               176    48   96
1004
magenta3             205     0  205
1005
maroon1              255    52  179
1005
magenta4             139     0  139
1006
maroon2              238    48  167
1006
maroon               176    48   96
1007
maroon3              205    41  144
1007
maroon1              255    52  179
1008
maroon4              139    28   98
1008
maroon2              238    48  167
1009
mediumaquamarine     102   205  170
1009
maroon3              205    41  144
1010
mediumblue             0     0  205
1010
maroon4              139    28   98
1011
mediumorchid         186    85  211
1011
mediumaquamarine     102   205  170
1012
mediumorchid1        224   102  255
1012
mediumblue             0     0  205
1013
mediumorchid2        209    95  238
1013
mediumorchid         186    85  211
1014
mediumorchid3        180    82  205
1014
mediumorchid1        224   102  255
1015
mediumorchid4        122    55  139
1015
mediumorchid2        209    95  238
1016
mediumpurple         147   112  219
1016
mediumorchid3        180    82  205
1017
mediumpurple1        171   130  255
1017
mediumorchid4        122    55  139
1018
mediumpurple2        159   121  238
1018
mediumpurple         147   112  219
1019
mediumpurple3        137   104  205
1019
mediumpurple1        171   130  255
1020
mediumpurple4         93    71  139
1020
mediumpurple2        159   121  238
1021
mediumseagreen        60   179  113
1021
mediumpurple3        137   104  205
1022
mediumslateblue      123   104  238
1022
mediumpurple4         93    71  139
1023
mediumspringgreen      0   250  154
1023
mediumseagreen        60   179  113
1024
mediumturquoise       72   209  204
1024
mediumslateblue      123   104  238
1025
mediumvioletred      199    21  133
1025
mediumspringgreen      0   250  154
1026
midnightblue          25    25  112
1026
mediumturquoise       72   209  204
1027
mintcream            245   255  250
1027
mediumvioletred      199    21  133
1028
mistyrose            255   228  225
1028
midnightblue          25    25  112
1029
mistyrose1           255   228  225
1029
mintcream            245   255  250
1030
mistyrose2           238   213  210
1030
mistyrose            255   228  225
1031
mistyrose3           205   183  181
1031
mistyrose1           255   228  225
1032
mistyrose4           139   125  123
1032
mistyrose2           238   213  210
1033
moccasin             255   228  181
1033
mistyrose3           205   183  181
1034
navajowhite          255   222  173
1034
mistyrose4           139   125  123
1035
navajowhite1         255   222  173
1035
moccasin             255   228  181
1036
navajowhite2         238   207  161
1036
navajowhite          255   222  173
1037
navajowhite3         205   179  139
1037
navajowhite1         255   222  173
1038
navajowhite4         139   121   94
1038
navajowhite2         238   207  161
1039
navy                   0     0  128
1039
navajowhite3         205   179  139
1040
navyblue               0     0  128
1040
navajowhite4         139   121   94
1041
oldlace              253   245  230
1041
navy                   0     0  128
1042
olivedrab            107   142   35
1042
navyblue               0     0  128
1043
olivedrab1           192   255   62
1043
oldlace              253   245  230
1044
olivedrab2           179   238   58
1044
olivedrab            107   142   35
1045
olivedrab3           154   205   50
1045
olivedrab1           192   255   62
1046
olivedrab4           105   139   34
1046
olivedrab2           179   238   58
1047
orange               255   165    0
1047
olivedrab3           154   205   50
1048
orange1              255   165    0
1048
olivedrab4           105   139   34
1049
orange2              238   154    0
1049
orange               255   165    0
1050
orange3              205   133    0
1050
orange1              255   165    0
1051
orange4              139    90    0
1051
orange2              238   154    0
1052
orangered            255    69    0
1052
orange3              205   133    0
1053
orangered1           255    69    0
1053
orange4              139    90    0
1054
orangered2           238    64    0
1054
orangered            255    69    0
1055
orangered3           205    55    0
1055
orangered1           255    69    0
1056
orangered4           139    37    0
1056
orangered2           238    64    0
1057
orchid               218   112  214
1057
orangered3           205    55    0
1058
orchid1              255   131  250
1058
orangered4           139    37    0
1059
orchid2              238   122  233
1059
orchid               218   112  214
1060
orchid3              205   105  201
1060
orchid1              255   131  250
1061
orchid4              139    71  137
1061
orchid2              238   122  233
1062
palegoldenrod        238   232  170
1062
orchid3              205   105  201
1063
palegreen            152   251  152
1063
orchid4              139    71  137
1064
palegreen1           154   255  154
1064
palegoldenrod        238   232  170
1065
palegreen2           144   238  144
1065
palegreen            152   251  152
1066
palegreen3           124   205  124
1066
palegreen1           154   255  154
1067
palegreen4            84   139   84
1067
palegreen2           144   238  144
1068
paleturquoise        175   238  238
1068
palegreen3           124   205  124
1069
paleturquoise1       187   255  255
1069
palegreen4            84   139   84
1070
paleturquoise2       174   238  238
1070
paleturquoise        175   238  238
1071
paleturquoise3       150   205  205
1071
paleturquoise1       187   255  255
1072
paleturquoise4       102   139  139
1072
paleturquoise2       174   238  238
1073
palevioletred        219   112  147
1073
paleturquoise3       150   205  205
1074
palevioletred1       255   130  171
1074
paleturquoise4       102   139  139
1075
palevioletred2       238   121  159
1075
palevioletred        219   112  147
1076
palevioletred3       205   104  137
1076
palevioletred1       255   130  171
1077
palevioletred4       139    71   93
1077
palevioletred2       238   121  159
1078
papayawhip           255   239  213
1078
palevioletred3       205   104  137
1079
peachpuff            255   218  185
1079
palevioletred4       139    71   93
1080
peachpuff1           255   218  185
1080
papayawhip           255   239  213
1081
peachpuff2           238   203  173
1081
peachpuff            255   218  185
1082
peachpuff3           205   175  149
1082
peachpuff1           255   218  185
1083
peachpuff4           139   119  101
1083
peachpuff2           238   203  173
1084
peru                 205   133   63
1084
peachpuff3           205   175  149
1085
pink                 255   192  203
1085
peachpuff4           139   119  101
1086
pink1                255   181  197
1086
peru                 205   133   63
1087
pink2                238   169  184
1087
pink                 255   192  203
1088
pink3                205   145  158
1088
pink1                255   181  197
1089
pink4                139    99  108
1089
pink2                238   169  184
1090
plum                 221   160  221
1090
pink3                205   145  158
1091
plum1                255   187  255
1091
pink4                139    99  108
1092
plum2                238   174  238
1092
plum                 221   160  221
1093
plum3                205   150  205
1093
plum1                255   187  255
1094
plum4                139   102  139
1094
plum2                238   174  238
1095
powderblue           176   224  230
1095
plum3                205   150  205
1096
purple               160    32  240
1096
plum4                139   102  139
1097
purple1              155    48  255
1097
powderblue           176   224  230
1098
purple2              145    44  238
1098
purple               160    32  240
1099
purple3              125    38  205
1099
purple1              155    48  255
1100
purple4               85    26  139
1100
purple2              145    44  238
1101
red                  255     0    0
1101
purple3              125    38  205
1102
red1                 255     0    0
1102
purple4               85    26  139
1103
red2                 238     0    0
1103
red                  255     0    0
1104
red3                 205     0    0
1104
red1                 255     0    0
1105
red4                 139     0    0
1105
red2                 238     0    0
1106
rosybrown            188   143  143
1106
red3                 205     0    0
1107
rosybrown1           255   193  193
1107
red4                 139     0    0
1108
rosybrown2           238   180  180
1108
rosybrown            188   143  143
1109
rosybrown3           205   155  155
1109
rosybrown1           255   193  193
1110
rosybrown4           139   105  105
1110
rosybrown2           238   180  180
1111
royalblue             65   105  225
1111
rosybrown3           205   155  155
1112
royalblue1            72   118  255
1112
rosybrown4           139   105  105
1113
royalblue2            67   110  238
1113
royalblue             65   105  225
1114
royalblue3            58    95  205
1114
royalblue1            72   118  255
1115
royalblue4            39    64  139
1115
royalblue2            67   110  238
1116
saddlebrown          139    69   19
1116
royalblue3            58    95  205
1117
salmon               250   128  114
1117
royalblue4            39    64  139
1118
salmon1              255   140  105
1118
saddlebrown          139    69   19
1119
salmon2              238   130   98
1119
salmon               250   128  114
1120
salmon3              205   112   84
1120
salmon1              255   140  105
1121
salmon4              139    76   57
1121
salmon2              238   130   98
1122
sandybrown           244   164   96
1122
salmon3              205   112   84
1123
seagreen              46   139   87
1123
salmon4              139    76   57
1124
seagreen1             84   255  159
1124
sandybrown           244   164   96
1125
seagreen2             78   238  148
1125
seagreen              46   139   87
1126
seagreen3             67   205  128
1126
seagreen1             84   255  159
1127
seagreen4             46   139   87
1127
seagreen2             78   238  148
1128
seashell             255   245  238
1128
seagreen3             67   205  128
1129
seashell1            255   245  238
1129
seagreen4             46   139   87
1130
seashell2            238   229  222
1130
seashell             255   245  238
1131
seashell3            205   197  191
1131
seashell1            255   245  238
1132
seashell4            139   134  130
1132
seashell2            238   229  222
1133
sienna               160    82   45
1133
seashell3            205   197  191
1134
sienna1              255   130   71
1134
seashell4            139   134  130
1135
sienna2              238   121   66
1135
sienna               160    82   45
1136
sienna3              205   104   57
1136
sienna1              255   130   71
1137
sienna4              139    71   38
1137
sienna2              238   121   66
1138
skyblue              135   206  235
1138
sienna3              205   104   57
1139
skyblue1             135   206  255
1139
sienna4              139    71   38
1140
skyblue2             126   192  238
1140
skyblue              135   206  235
1141
skyblue3             108   166  205
1141
skyblue1             135   206  255
1142
skyblue4              74   112  139
1142
skyblue2             126   192  238
1143
slateblue            106    90  205
1143
skyblue3             108   166  205
1144
slateblue1           131   111  255
1144
skyblue4              74   112  139
1145
slateblue2           122   103  238
1145
slateblue            106    90  205
1146
slateblue3           105    89  205
1146
slateblue1           131   111  255
1147
slateblue4            71    60  139
1147
slateblue2           122   103  238
1148
slategray            112   128  144
1148
slateblue3           105    89  205
1149
slategray1           198   226  255
1149
slateblue4            71    60  139
1150
slategray2           185   211  238
1150
slategray            112   128  144
1151
slategray3           159   182  205
1151
slategray1           198   226  255
1152
slategray4           108   123  139
1152
slategray2           185   211  238
1153
slategrey            112   128  144
1153
slategray3           159   182  205
1154
snow                 255   250  250
1154
slategray4           108   123  139
1155
snow1                255   250  250
1155
slategrey            112   128  144
1156
snow2                238   233  233
1156
snow                 255   250  250
1157
snow3                205   201  201
1157
snow1                255   250  250
1158
snow4                139   137  137
1158
snow2                238   233  233
1159
springgreen            0   255  127
1159
snow3                205   201  201
1160
springgreen1           0   255  127
1160
snow4                139   137  137
1161
springgreen2           0   238  118
1161
springgreen            0   255  127
1162
springgreen3           0   205  102
1162
springgreen1           0   255  127
1163
springgreen4           0   139   69
1163
springgreen2           0   238  118
1164
steelblue             70   130  180
1164
springgreen3           0   205  102
1165
steelblue1            99   184  255
1165
springgreen4           0   139   69
1166
steelblue2            92   172  238
1166
steelblue             70   130  180
1167
steelblue3            79   148  205
1167
steelblue1            99   184  255
1168
steelblue4            54   100  139
1168
steelblue2            92   172  238
1169
tan                  210   180  140
1169
steelblue3            79   148  205
1170
tan1                 255   165   79
1170
steelblue4            54   100  139
1171
tan2                 238   154   73
1171
tan                  210   180  140
1172
tan3                 205   133   63
1172
tan1                 255   165   79
1173
tan4                 139    90   43
1173
tan2                 238   154   73
1174
thistle              216   191  216
1174
tan3                 205   133   63
1175
thistle1             255   225  255
1175
tan4                 139    90   43
1176
thistle2             238   210  238
1176
thistle              216   191  216
1177
thistle3             205   181  205
1177
thistle1             255   225  255
1178
thistle4             139   123  139
1178
thistle2             238   210  238
1179
tomato               255    99   71
1179
thistle3             205   181  205
1180
tomato1              255    99   71
1180
thistle4             139   123  139
1181
tomato2              238    92   66
1181
tomato               255    99   71
1182
tomato3              205    79   57
1182
tomato1              255    99   71
1183
tomato4              139    54   38
1183
tomato2              238    92   66
1184
turquoise             64   224  208
1184
tomato3              205    79   57
1185
turquoise1             0   245  255
1185
tomato4              139    54   38
1186
turquoise2             0   229  238
1186
turquoise             64   224  208
1187
turquoise3             0   197  205
1187
turquoise1             0   245  255
1188
turquoise4             0   134  139
1188
turquoise2             0   229  238
1189
violet               238   130  238
1189
turquoise3             0   197  205
1190
violetred            208    32  144
1190
turquoise4             0   134  139
1191
violetred1           255    62  150
1191
violet               238   130  238
1192
violetred2           238    58  140
1192
violetred            208    32  144
1193
violetred3           205    50  120
1193
violetred1           255    62  150
1194
violetred4           139    34   82
1194
violetred2           238    58  140
1195
wheat                245   222  179
1195
violetred3           205    50  120
1196
wheat1               255   231  186
1196
violetred4           139    34   82
1197
wheat2               238   216  174
1197
wheat                245   222  179
1198
wheat3               205   186  150
1198
wheat1               255   231  186
1199
wheat4               139   126  102
1199
wheat2               238   216  174
1200
whitesmoke           245   245  245
1200
wheat3               205   186  150
1201
yellow               255   255    0
1201
wheat4               139   126  102
1202
yellow1              255   255    0
1202
whitesmoke           245   245  245
1203
yellow2              238   238    0
1203
yellow               255   255    0
1204
yellow3              205   205    0
1204
yellow1              255   255    0
1205
yellow4              139   139    0
1205
yellow2              238   238    0
1206
yellowgreen          154   205   50
1206
yellow3              205   205    0
1207
> 
1207
yellow4              139   139    0
1208
> ccodes <- c(256^(2:0) %*% crgb)## = internal codes
1208
yellowgreen          154   205   50
1209
> ## How many names are 'aliases' of each other:
1209
> 
1210
> table(tcc <- table(ccodes))
1210
> ccodes <- c(256^(2:0) %*% crgb)## = internal codes
1211
 
1211
> ## How many names are 'aliases' of each other:
1212
  1   2   3   4 
1212
> table(tcc <- table(ccodes))
1213
352 146   3   1 
1213
 
1214
> length(uc <- unique(sort(ccodes))) # 502
1214
  1   2   3   4 
1215
[1] 502
1215
352 146   3   1 
1216
> ## All the multiply named colors:
1216
> length(uc <- unique(sort(ccodes))) # 502
1217
> mult <- uc[tcc >= 2]
1217
[1] 502
1218
> cl <- lapply(mult, function(m) cc[ccodes == m])
1218
> ## All the multiply named colors:
1219
> names(cl) <- apply(col2rgb(sapply(cl, function(x)x[1])),
1219
> mult <- uc[tcc >= 2]
1220
+                    2, function(n)paste(n, collapse=","))
1220
> cl <- lapply(mult, function(m) cc[ccodes == m])
1221
> utils::str(cl)
1221
> names(cl) <- apply(col2rgb(sapply(cl, function(x)x[1])),
1222
List of 150
1222
+                    2, function(n)paste(n, collapse=","))
1223
 $ 0,0,0      : chr [1:3] "black" "gray0" "grey0"
1223
> utils::str(cl)
1224
 $ 0,0,128    : chr [1:2] "navy" "navyblue"
1224
List of 150
1225
 $ 0,0,139    : chr [1:2] "blue4" "darkblue"
1225
 $ 0,0,0      : chr [1:3] "black" "gray0" "grey0"
1226
 $ 0,0,205    : chr [1:2] "blue3" "mediumblue"
1226
 $ 0,0,128    : chr [1:2] "navy" "navyblue"
1227
 $ 0,0,255    : chr [1:2] "blue" "blue1"
1227
 $ 0,0,139    : chr [1:2] "blue4" "darkblue"
1228
 $ 0,139,139  : chr [1:2] "cyan4" "darkcyan"
1228
 $ 0,0,205    : chr [1:2] "blue3" "mediumblue"
1229
 $ 0,191,255  : chr [1:2] "deepskyblue" "deepskyblue1"
1229
 $ 0,0,255    : chr [1:2] "blue" "blue1"
1230
 $ 0,255,0    : chr [1:2] "green" "green1"
1230
 $ 0,139,139  : chr [1:2] "cyan4" "darkcyan"
1231
 $ 0,255,127  : chr [1:2] "springgreen" "springgreen1"
1231
 $ 0,191,255  : chr [1:2] "deepskyblue" "deepskyblue1"
1232
 $ 0,255,255  : chr [1:2] "cyan" "cyan1"
1232
 $ 0,255,0    : chr [1:2] "green" "green1"
1233
 $ 3,3,3      : chr [1:2] "gray1" "grey1"
1233
 $ 0,255,127  : chr [1:2] "springgreen" "springgreen1"
1234
 $ 5,5,5      : chr [1:2] "gray2" "grey2"
1234
 $ 0,255,255  : chr [1:2] "cyan" "cyan1"
1235
 $ 8,8,8      : chr [1:2] "gray3" "grey3"
1235
 $ 3,3,3      : chr [1:2] "gray1" "grey1"
1236
 $ 10,10,10   : chr [1:2] "gray4" "grey4"
1236
 $ 5,5,5      : chr [1:2] "gray2" "grey2"
1237
 $ 13,13,13   : chr [1:2] "gray5" "grey5"
1237
 $ 8,8,8      : chr [1:2] "gray3" "grey3"
1238
 $ 15,15,15   : chr [1:2] "gray6" "grey6"
1238
 $ 10,10,10   : chr [1:2] "gray4" "grey4"
1239
 $ 18,18,18   : chr [1:2] "gray7" "grey7"
1239
 $ 13,13,13   : chr [1:2] "gray5" "grey5"
1240
 $ 20,20,20   : chr [1:2] "gray8" "grey8"
1240
 $ 15,15,15   : chr [1:2] "gray6" "grey6"
1241
 $ 23,23,23   : chr [1:2] "gray9" "grey9"
1241
 $ 18,18,18   : chr [1:2] "gray7" "grey7"
1242
 $ 26,26,26   : chr [1:2] "gray10" "grey10"
1242
 $ 20,20,20   : chr [1:2] "gray8" "grey8"
1243
 $ 28,28,28   : chr [1:2] "gray11" "grey11"
1243
 $ 23,23,23   : chr [1:2] "gray9" "grey9"
1244
 $ 30,144,255 : chr [1:2] "dodgerblue" "dodgerblue1"
1244
 $ 26,26,26   : chr [1:2] "gray10" "grey10"
1245
 $ 31,31,31   : chr [1:2] "gray12" "grey12"
1245
 $ 28,28,28   : chr [1:2] "gray11" "grey11"
1246
 $ 33,33,33   : chr [1:2] "gray13" "grey13"
1246
 $ 30,144,255 : chr [1:2] "dodgerblue" "dodgerblue1"
1247
 $ 36,36,36   : chr [1:2] "gray14" "grey14"
1247
 $ 31,31,31   : chr [1:2] "gray12" "grey12"
1248
 $ 38,38,38   : chr [1:2] "gray15" "grey15"
1248
 $ 33,33,33   : chr [1:2] "gray13" "grey13"
1249
 $ 41,41,41   : chr [1:2] "gray16" "grey16"
1249
 $ 36,36,36   : chr [1:2] "gray14" "grey14"
1250
 $ 43,43,43   : chr [1:2] "gray17" "grey17"
1250
 $ 38,38,38   : chr [1:2] "gray15" "grey15"
1251
 $ 46,46,46   : chr [1:2] "gray18" "grey18"
1251
 $ 41,41,41   : chr [1:2] "gray16" "grey16"
1252
 $ 46,139,87  : chr [1:2] "seagreen" "seagreen4"
1252
 $ 43,43,43   : chr [1:2] "gray17" "grey17"
1253
 $ 47,79,79   : chr [1:2] "darkslategray" "darkslategrey"
1253
 $ 46,46,46   : chr [1:2] "gray18" "grey18"
1254
 $ 48,48,48   : chr [1:2] "gray19" "grey19"
1254
 $ 46,139,87  : chr [1:2] "seagreen" "seagreen4"
1255
 $ 51,51,51   : chr [1:2] "gray20" "grey20"
1255
 $ 47,79,79   : chr [1:2] "darkslategray" "darkslategrey"
1256
 $ 54,54,54   : chr [1:2] "gray21" "grey21"
1256
 $ 48,48,48   : chr [1:2] "gray19" "grey19"
1257
 $ 56,56,56   : chr [1:2] "gray22" "grey22"
1257
 $ 51,51,51   : chr [1:2] "gray20" "grey20"
1258
 $ 59,59,59   : chr [1:2] "gray23" "grey23"
1258
 $ 54,54,54   : chr [1:2] "gray21" "grey21"
1259
 $ 61,61,61   : chr [1:2] "gray24" "grey24"
1259
 $ 56,56,56   : chr [1:2] "gray22" "grey22"
1260
 $ 64,64,64   : chr [1:2] "gray25" "grey25"
1260
 $ 59,59,59   : chr [1:2] "gray23" "grey23"
1261
 $ 66,66,66   : chr [1:2] "gray26" "grey26"
1261
 $ 61,61,61   : chr [1:2] "gray24" "grey24"
1262
 $ 69,69,69   : chr [1:2] "gray27" "grey27"
1262
 $ 64,64,64   : chr [1:2] "gray25" "grey25"
1263
 $ 71,71,71   : chr [1:2] "gray28" "grey28"
1263
 $ 66,66,66   : chr [1:2] "gray26" "grey26"
1264
 $ 74,74,74   : chr [1:2] "gray29" "grey29"
1264
 $ 69,69,69   : chr [1:2] "gray27" "grey27"
1265
 $ 77,77,77   : chr [1:2] "gray30" "grey30"
1265
 $ 71,71,71   : chr [1:2] "gray28" "grey28"
1266
 $ 79,79,79   : chr [1:2] "gray31" "grey31"
1266
 $ 74,74,74   : chr [1:2] "gray29" "grey29"
1267
 $ 82,82,82   : chr [1:2] "gray32" "grey32"
1267
 $ 77,77,77   : chr [1:2] "gray30" "grey30"
1268
 $ 84,84,84   : chr [1:2] "gray33" "grey33"
1268
 $ 79,79,79   : chr [1:2] "gray31" "grey31"
1269
 $ 87,87,87   : chr [1:2] "gray34" "grey34"
1269
 $ 82,82,82   : chr [1:2] "gray32" "grey32"
1270
 $ 89,89,89   : chr [1:2] "gray35" "grey35"
1270
 $ 84,84,84   : chr [1:2] "gray33" "grey33"
1271
 $ 92,92,92   : chr [1:2] "gray36" "grey36"
1271
 $ 87,87,87   : chr [1:2] "gray34" "grey34"
1272
 $ 94,94,94   : chr [1:2] "gray37" "grey37"
1272
 $ 89,89,89   : chr [1:2] "gray35" "grey35"
1273
 $ 97,97,97   : chr [1:2] "gray38" "grey38"
1273
 $ 92,92,92   : chr [1:2] "gray36" "grey36"
1274
 $ 99,99,99   : chr [1:2] "gray39" "grey39"
1274
 $ 94,94,94   : chr [1:2] "gray37" "grey37"
1275
 $ 102,102,102: chr [1:2] "gray40" "grey40"
1275
 $ 97,97,97   : chr [1:2] "gray38" "grey38"
1276
 $ 102,205,170: chr [1:2] "aquamarine3" "mediumaquamarine"
1276
 $ 99,99,99   : chr [1:2] "gray39" "grey39"
1277
 $ 105,105,105: chr [1:4] "dimgray" "dimgrey" "gray41" "grey41"
1277
 $ 102,102,102: chr [1:2] "gray40" "grey40"
1278
 $ 107,107,107: chr [1:2] "gray42" "grey42"
1278
 $ 102,205,170: chr [1:2] "aquamarine3" "mediumaquamarine"
1279
 $ 110,110,110: chr [1:2] "gray43" "grey43"
1279
 $ 105,105,105: chr [1:4] "dimgray" "dimgrey" "gray41" "grey41"
1280
 $ 112,112,112: chr [1:2] "gray44" "grey44"
1280
 $ 107,107,107: chr [1:2] "gray42" "grey42"
1281
 $ 112,128,144: chr [1:2] "slategray" "slategrey"
1281
 $ 110,110,110: chr [1:2] "gray43" "grey43"
1282
 $ 115,115,115: chr [1:2] "gray45" "grey45"
1282
 $ 112,112,112: chr [1:2] "gray44" "grey44"
1283
 $ 117,117,117: chr [1:2] "gray46" "grey46"
1283
 $ 112,128,144: chr [1:2] "slategray" "slategrey"
1284
 $ 119,136,153: chr [1:2] "lightslategray" "lightslategrey"
1284
 $ 115,115,115: chr [1:2] "gray45" "grey45"
1285
 $ 120,120,120: chr [1:2] "gray47" "grey47"
1285
 $ 117,117,117: chr [1:2] "gray46" "grey46"
1286
 $ 122,122,122: chr [1:2] "gray48" "grey48"
1286
 $ 119,136,153: chr [1:2] "lightslategray" "lightslategrey"
1287
 $ 125,125,125: chr [1:2] "gray49" "grey49"
1287
 $ 120,120,120: chr [1:2] "gray47" "grey47"
1288
 $ 127,127,127: chr [1:2] "gray50" "grey50"
1288
 $ 122,122,122: chr [1:2] "gray48" "grey48"
1289
 $ 127,255,0  : chr [1:2] "chartreuse" "chartreuse1"
1289
 $ 125,125,125: chr [1:2] "gray49" "grey49"
1290
 $ 127,255,212: chr [1:2] "aquamarine" "aquamarine1"
1290
 $ 127,127,127: chr [1:2] "gray50" "grey50"
1291
 $ 130,130,130: chr [1:2] "gray51" "grey51"
1291
 $ 127,255,0  : chr [1:2] "chartreuse" "chartreuse1"
1292
 $ 133,133,133: chr [1:2] "gray52" "grey52"
1292
 $ 127,255,212: chr [1:2] "aquamarine" "aquamarine1"
1293
 $ 135,135,135: chr [1:2] "gray53" "grey53"
1293
 $ 130,130,130: chr [1:2] "gray51" "grey51"
1294
 $ 138,138,138: chr [1:2] "gray54" "grey54"
1294
 $ 133,133,133: chr [1:2] "gray52" "grey52"
1295
 $ 139,0,0    : chr [1:2] "darkred" "red4"
1295
 $ 135,135,135: chr [1:2] "gray53" "grey53"
1296
 $ 139,0,139  : chr [1:2] "darkmagenta" "magenta4"
1296
 $ 138,138,138: chr [1:2] "gray54" "grey54"
1297
 $ 139,69,19  : chr [1:2] "chocolate4" "saddlebrown"
1297
 $ 139,0,0    : chr [1:2] "darkred" "red4"
1298
 $ 140,140,140: chr [1:2] "gray55" "grey55"
1298
 $ 139,0,139  : chr [1:2] "darkmagenta" "magenta4"
1299
 $ 143,143,143: chr [1:2] "gray56" "grey56"
1299
 $ 139,69,19  : chr [1:2] "chocolate4" "saddlebrown"
1300
 $ 144,238,144: chr [1:2] "lightgreen" "palegreen2"
1300
 $ 140,140,140: chr [1:2] "gray55" "grey55"
1301
 $ 145,145,145: chr [1:2] "gray57" "grey57"
1301
 $ 143,143,143: chr [1:2] "gray56" "grey56"
1302
 $ 148,148,148: chr [1:2] "gray58" "grey58"
1302
 $ 144,238,144: chr [1:2] "lightgreen" "palegreen2"
1303
 $ 150,150,150: chr [1:2] "gray59" "grey59"
1303
 $ 145,145,145: chr [1:2] "gray57" "grey57"
1304
 $ 153,153,153: chr [1:2] "gray60" "grey60"
1304
 $ 148,148,148: chr [1:2] "gray58" "grey58"
1305
 $ 154,205,50 : chr [1:2] "olivedrab3" "yellowgreen"
1305
 $ 150,150,150: chr [1:2] "gray59" "grey59"
1306
 $ 156,156,156: chr [1:2] "gray61" "grey61"
1306
 $ 153,153,153: chr [1:2] "gray60" "grey60"
1307
 $ 158,158,158: chr [1:2] "gray62" "grey62"
1307
 $ 154,205,50 : chr [1:2] "olivedrab3" "yellowgreen"
1308
 $ 161,161,161: chr [1:2] "gray63" "grey63"
1308
 $ 156,156,156: chr [1:2] "gray61" "grey61"
1309
 $ 163,163,163: chr [1:2] "gray64" "grey64"
1309
 $ 158,158,158: chr [1:2] "gray62" "grey62"
1310
 $ 166,166,166: chr [1:2] "gray65" "grey65"
1310
 $ 161,161,161: chr [1:2] "gray63" "grey63"
1311
 $ 168,168,168: chr [1:2] "gray66" "grey66"
1311
 $ 163,163,163: chr [1:2] "gray64" "grey64"
1312
 $ 169,169,169: chr [1:2] "darkgray" "darkgrey"
1312
 $ 166,166,166: chr [1:2] "gray65" "grey65"
1313
 $ 171,171,171: chr [1:2] "gray67" "grey67"
1313
 $ 168,168,168: chr [1:2] "gray66" "grey66"
1314
 $ 173,173,173: chr [1:2] "gray68" "grey68"
1314
 $ 169,169,169: chr [1:2] "darkgray" "darkgrey"
1315
 $ 176,176,176: chr [1:2] "gray69" "grey69"
1315
 $ 171,171,171: chr [1:2] "gray67" "grey67"
1316
 $ 179,179,179: chr [1:2] "gray70" "grey70"
1316
 $ 173,173,173: chr [1:2] "gray68" "grey68"
1317
 $ 181,181,181: chr [1:2] "gray71" "grey71"
1317
 $ 176,176,176: chr [1:2] "gray69" "grey69"
1318
 $ 184,184,184: chr [1:2] "gray72" "grey72"
1318
 $ 179,179,179: chr [1:2] "gray70" "grey70"
1319
 $ 186,186,186: chr [1:2] "gray73" "grey73"
1319
 $ 181,181,181: chr [1:2] "gray71" "grey71"
1320
 $ 189,189,189: chr [1:2] "gray74" "grey74"
1320
 $ 184,184,184: chr [1:2] "gray72" "grey72"
1321
 $ 190,190,190: chr [1:2] "gray" "grey"
1321
 $ 186,186,186: chr [1:2] "gray73" "grey73"
1322
  [list output truncated]
1322
 $ 189,189,189: chr [1:2] "gray74" "grey74"
1323
> ## Not run: 
1323
 $ 190,190,190: chr [1:2] "gray" "grey"
1324
> ##D  if(require(xgobi)) { ## Look at the color cube dynamically :
1324
  [list output truncated]
1325
> ##D    tc <- t(crgb[, !duplicated(ccodes)])
1325
> ## Not run: 
1326
> ##D    table(is.gray <- tc[,1] == tc[,2] & tc[,2] == tc[,3])# (397, 105)
1326
> ##D  if(require(xgobi)) { ## Look at the color cube dynamically :
1327
> ##D    xgobi(tc, color = c("gold", "gray")[1 + is.gray])
1327
> ##D    tc <- t(crgb[, !duplicated(ccodes)])
1328
> ##D  }
1328
> ##D    table(is.gray <- tc[,1] == tc[,2] & tc[,2] == tc[,3])# (397, 105)
1329
> ## End(Not run)
1329
> ##D    xgobi(tc, color = c("gold", "gray")[1 + is.gray])
1330
> 
1330
> ##D  }
1331
> 
1331
> ## End(Not run)
1332
> 
1332
> 
1333
> cleanEx()
1333
> 
1334
> nameEx("colorRamp")
1334
> 
1335
> ### * colorRamp
1335
> cleanEx()
1336
> 
1336
> nameEx("colorRamp")
1337
> flush(stderr()); flush(stdout())
1337
> ### * colorRamp
1338
> 
1338
> 
1339
> ### Name: colorRamp
1339
> flush(stderr()); flush(stdout())
1340
> ### Title: Color interpolation
1340
> 
1341
> ### Aliases: colorRamp colorRampPalette
1341
> ### Name: colorRamp
1342
> ### Keywords: color
1342
> ### Title: Color interpolation
1343
> 
1343
> ### Aliases: colorRamp colorRampPalette
1344
> ### ** Examples
1344
> ### Keywords: color
1345
> 
1345
> 
1346
> require(graphics)
1346
> ### ** Examples
1347
> 
1347
> 
1348
> ## Here space="rgb" gives palettes that vary only in saturation,
1348
> require(graphics)
1349
> ## as intended.
1349
> 
1350
> ## With space="Lab" the steps are more uniform, but the hues
1350
> ## Here space="rgb" gives palettes that vary only in saturation,
1351
> ## are slightly purple.
1351
> ## as intended.
1352
> filled.contour(volcano,
1352
> ## With space="Lab" the steps are more uniform, but the hues
1353
+                color.palette =
1353
> ## are slightly purple.
1354
+                    colorRampPalette(c("red", "white", "blue")),
1354
> filled.contour(volcano,
1355
+                asp = 1)
1355
+                color.palette =
1356
> filled.contour(volcano,
1356
+                    colorRampPalette(c("red", "white", "blue")),
1357
+                color.palette =
1357
+                asp = 1)
1358
+                    colorRampPalette(c("red", "white", "blue"),
1358
> filled.contour(volcano,
1359
+                                     space = "Lab"),
1359
+                color.palette =
1360
+                asp = 1)
1360
+                    colorRampPalette(c("red", "white", "blue"),
1361
> 
1361
+                                     space = "Lab"),
1362
> ## Interpolating a 'sequential' ColorBrewer palette
1362
+                asp = 1)
1363
> YlOrBr <- c("#FFFFD4", "#FED98E", "#FE9929", "#D95F0E", "#993404")
1363
> 
1364
> filled.contour(volcano,
1364
> ## Interpolating a 'sequential' ColorBrewer palette
1365
+                color.palette = colorRampPalette(YlOrBr, space = "Lab"),
1365
> YlOrBr <- c("#FFFFD4", "#FED98E", "#FE9929", "#D95F0E", "#993404")
1366
+                asp = 1)
1366
> filled.contour(volcano,
1367
> filled.contour(volcano,
1367
+                color.palette = colorRampPalette(YlOrBr, space = "Lab"),
1368
+                color.palette = colorRampPalette(YlOrBr, space = "Lab",
1368
+                asp = 1)
1369
+                                                 bias = 0.5),
1369
> filled.contour(volcano,
1370
+                asp = 1)
1370
+                color.palette = colorRampPalette(YlOrBr, space = "Lab",
1371
> 
1371
+                                                 bias = 0.5),
1372
> ## 'jet.colors' is "as in Matlab"
1372
+                asp = 1)
1373
> ## (and hurting the eyes by over-saturation)
1373
> 
1374
> jet.colors <-
1374
> ## 'jet.colors' is "as in Matlab"
1375
+   colorRampPalette(c("#00007F", "blue", "#007FFF", "cyan",
1375
> ## (and hurting the eyes by over-saturation)
1376
+                      "#7FFF7F", "yellow", "#FF7F00", "red", "#7F0000"))
1376
> jet.colors <-
1377
> filled.contour(volcano, color = jet.colors, asp = 1)
1377
+   colorRampPalette(c("#00007F", "blue", "#007FFF", "cyan",
1378
> 
1378
+                      "#7FFF7F", "yellow", "#FF7F00", "red", "#7F0000"))
1379
> ## space="Lab" helps when colors don't form a natural sequence
1379
> filled.contour(volcano, color = jet.colors, asp = 1)
1380
> m <- outer(1:20,1:20,function(x,y) sin(sqrt(x*y)/3))
1380
> 
1381
> rgb.palette <- colorRampPalette(c("red", "orange", "blue"),
1381
> ## space="Lab" helps when colors don't form a natural sequence
1382
+                                 space = "rgb")
1382
> m <- outer(1:20,1:20,function(x,y) sin(sqrt(x*y)/3))
1383
> Lab.palette <- colorRampPalette(c("red", "orange", "blue"),
1383
> rgb.palette <- colorRampPalette(c("red", "orange", "blue"),
1384
+                                 space = "Lab")
1384
+                                 space = "rgb")
1385
> filled.contour(m, col = rgb.palette(20))
1385
> Lab.palette <- colorRampPalette(c("red", "orange", "blue"),
1386
> filled.contour(m, col = Lab.palette(20))
1386
+                                 space = "Lab")
1387
> 
1387
> filled.contour(m, col = rgb.palette(20))
1388
> 
1388
> filled.contour(m, col = Lab.palette(20))
1389
> 
1389
> 
1390
> cleanEx()
1390
> 
1391
> nameEx("colors")
1391
> 
1392
> ### * colors
1392
> cleanEx()
1393
> 
1393
> nameEx("colors")
1394
> flush(stderr()); flush(stdout())
1394
> ### * colors
1395
> 
1395
> 
1396
> ### Name: colors
1396
> flush(stderr()); flush(stdout())
1397
> ### Title: Color Names
1397
> 
1398
> ### Aliases: colors colours
1398
> ### Name: colors
1399
> ### Keywords: color dplot sysdata
1399
> ### Title: Color Names
1400
> 
1400
> ### Aliases: colors colours
1401
> ### ** Examples
1401
> ### Keywords: color dplot sysdata
1402
> 
1402
> 
1403
> cl <- colors()
1403
> ### ** Examples
1404
> length(cl); cl[1:20]
1404
> 
1405
[1] 657
1405
> cl <- colors()
1406
 [1] "white"         "aliceblue"     "antiquewhite"  "antiquewhite1"
1406
> length(cl); cl[1:20]
1407
 [5] "antiquewhite2" "antiquewhite3" "antiquewhite4" "aquamarine"   
1407
[1] 657
1408
 [9] "aquamarine1"   "aquamarine2"   "aquamarine3"   "aquamarine4"  
1408
 [1] "white"         "aliceblue"     "antiquewhite"  "antiquewhite1"
1409
[13] "azure"         "azure1"        "azure2"        "azure3"       
1409
 [5] "antiquewhite2" "antiquewhite3" "antiquewhite4" "aquamarine"   
1410
[17] "azure4"        "beige"         "bisque"        "bisque1"      
1410
 [9] "aquamarine1"   "aquamarine2"   "aquamarine3"   "aquamarine4"  
1411
> 
1411
[13] "azure"         "azure1"        "azure2"        "azure3"       
1412
> 
1412
[17] "azure4"        "beige"         "bisque"        "bisque1"      
1413
> 
1413
> 
1414
> cleanEx()
1414
> 
1415
> nameEx("contourLines")
1415
> 
1416
> ### * contourLines
1416
> cleanEx()
1417
> 
1417
> nameEx("contourLines")
1418
> flush(stderr()); flush(stdout())
1418
> ### * contourLines
1419
> 
1419
> 
1420
> ### Name: contourLines
1420
> flush(stderr()); flush(stdout())
1421
> ### Title: Calculate Contour Lines
1421
> 
1422
> ### Aliases: contourLines
1422
> ### Name: contourLines
1423
> ### Keywords: dplot
1423
> ### Title: Calculate Contour Lines
1424
> 
1424
> ### Aliases: contourLines
1425
> ### ** Examples
1425
> ### Keywords: dplot
1426
> 
1426
> 
1427
> x <- 10*1:nrow(volcano)
1427
> ### ** Examples
1428
> y <- 10*1:ncol(volcano)
1428
> 
1429
> contourLines(x, y, volcano)
1429
> x <- 10*1:nrow(volcano)
1430
> 
1430
> y <- 10*1:ncol(volcano)
1431
> 
1431
> contourLines(x, y, volcano)
1432
> 
1432
> 
1433
> cleanEx()
1433
> 
1434
> nameEx("convertColor")
1434
> 
1435
> ### * convertColor
1435
> cleanEx()
1436
> 
1436
> nameEx("convertColor")
1437
> flush(stderr()); flush(stdout())
1437
> ### * convertColor
1438
> 
1438
> 
1439
> ### Name: convertColor
1439
> flush(stderr()); flush(stdout())
1440
> ### Title: Convert between colour spaces
1440
> 
1441
> ### Aliases: convertColor colorspaces
1441
> ### Name: convertColor
1442
> ### Keywords: color
1442
> ### Title: Convert between colour spaces
1443
> 
1443
> ### Aliases: convertColor colorspaces
1444
> ### ** Examples
1444
> ### Keywords: color
1445
> 
1445
> 
1446
> require(graphics); require(stats) # for na.omit
1446
> ### ** Examples
1447
> par(mfrow=c(2,2))
1447
> 
1448
> ## The displayable colors from four planes of Lab space
1448
> require(graphics); require(stats) # for na.omit
1449
> ab <- expand.grid(a=(-10:15)*10,b=(-15:10)*10)
1449
> par(mfrow=c(2,2))
1450
> 
1450
> ## The displayable colors from four planes of Lab space
1451
> Lab <- cbind(L=20,ab)
1451
> ab <- expand.grid(a=(-10:15)*10,b=(-15:10)*10)
1452
> srgb <- convertColor(Lab,from="Lab",to="sRGB",clip=NA)
1452
> 
1453
> clipped <- attr(na.omit(srgb),"na.action")
1453
> Lab <- cbind(L=20,ab)
1454
> srgb[clipped,] <- 0
1454
> srgb <- convertColor(Lab,from="Lab",to="sRGB",clip=NA)
1455
> cols <- rgb(srgb[,1],srgb[,2],srgb[,3])
1455
> clipped <- attr(na.omit(srgb),"na.action")
1456
> image((-10:15)*10,(-15:10)*10,matrix(1:(26*26),ncol=26),col=cols,
1456
> srgb[clipped,] <- 0
1457
+   xlab="a",ylab="b",main="Lab: L=20")
1457
> cols <- rgb(srgb[,1],srgb[,2],srgb[,3])
1458
> 
1458
> image((-10:15)*10,(-15:10)*10,matrix(1:(26*26),ncol=26),col=cols,
1459
> Lab <- cbind(L=40,ab)
1459
+   xlab="a",ylab="b",main="Lab: L=20")
1460
> srgb <- convertColor(Lab,from="Lab",to="sRGB",clip=NA)
1460
> 
1461
> clipped <- attr(na.omit(srgb),"na.action")
1461
> Lab <- cbind(L=40,ab)
1462
> srgb[clipped,] <- 0
1462
> srgb <- convertColor(Lab,from="Lab",to="sRGB",clip=NA)
1463
> cols <- rgb(srgb[,1],srgb[,2],srgb[,3])
1463
> clipped <- attr(na.omit(srgb),"na.action")
1464
> image((-10:15)*10,(-15:10)*10,matrix(1:(26*26),ncol=26),col=cols,
1464
> srgb[clipped,] <- 0
1465
+   xlab="a",ylab="b",main="Lab: L=40")
1465
> cols <- rgb(srgb[,1],srgb[,2],srgb[,3])
1466
> 
1466
> image((-10:15)*10,(-15:10)*10,matrix(1:(26*26),ncol=26),col=cols,
1467
> Lab <- cbind(L=60,ab)
1467
+   xlab="a",ylab="b",main="Lab: L=40")
1468
> srgb <- convertColor(Lab,from="Lab",to="sRGB",clip=NA)
1468
> 
1469
> clipped <- attr(na.omit(srgb),"na.action")
1469
> Lab <- cbind(L=60,ab)
1470
> srgb[clipped,] <- 0
1470
> srgb <- convertColor(Lab,from="Lab",to="sRGB",clip=NA)
1471
> cols <- rgb(srgb[,1],srgb[,2],srgb[,3])
1471
> clipped <- attr(na.omit(srgb),"na.action")
1472
> image((-10:15)*10,(-15:10)*10,matrix(1:(26*26),ncol=26),col=cols,
1472
> srgb[clipped,] <- 0
1473
+   xlab="a",ylab="b",main="Lab: L=60")
1473
> cols <- rgb(srgb[,1],srgb[,2],srgb[,3])
1474
> 
1474
> image((-10:15)*10,(-15:10)*10,matrix(1:(26*26),ncol=26),col=cols,
1475
> Lab <- cbind(L=80,ab)
1475
+   xlab="a",ylab="b",main="Lab: L=60")
1476
> srgb <- convertColor(Lab,from="Lab",to="sRGB",clip=NA)
1476
> 
1477
> clipped <- attr(na.omit(srgb),"na.action")
1477
> Lab <- cbind(L=80,ab)
1478
> srgb[clipped,] <- 0
1478
> srgb <- convertColor(Lab,from="Lab",to="sRGB",clip=NA)
1479
> cols <- rgb(srgb[,1],srgb[,2],srgb[,3])
1479
> clipped <- attr(na.omit(srgb),"na.action")
1480
> image((-10:15)*10,(-15:10)*10,matrix(1:(26*26),ncol=26),col=cols,
1480
> srgb[clipped,] <- 0
1481
+   xlab="a",ylab="b",main="Lab: L=80")
1481
> cols <- rgb(srgb[,1],srgb[,2],srgb[,3])
1482
> 
1482
> image((-10:15)*10,(-15:10)*10,matrix(1:(26*26),ncol=26),col=cols,
1483
> (cols <- t(col2rgb(palette())))
1483
+   xlab="a",ylab="b",main="Lab: L=80")
1484
     red green blue
1484
> 
1485
[1,]   0     0    0
1485
> (cols <- t(col2rgb(palette())))
1486
[2,] 255     0    0
1486
     red green blue
1487
[3,]   0   205    0
1487
[1,]   0     0    0
1488
[4,]   0     0  255
1488
[2,] 255     0    0
1489
[5,]   0   255  255
1489
[3,]   0   205    0
1490
[6,] 255     0  255
1490
[4,]   0     0  255
1491
[7,] 255   255    0
1491
[5,]   0   255  255
1492
[8,] 190   190  190
1492
[6,] 255     0  255
1493
> zapsmall(lab <- convertColor(cols,from="sRGB",to="Lab",scale.in=255))
1493
[7,] 255   255    0
1494
            L       a.x          b
1494
[8,] 190   190  190
1495
[1,]  0.00000   0.00000    0.00000
1495
> zapsmall(lab <- convertColor(cols,from="sRGB",to="Lab",scale.in=255))
1496
[2,] 53.48418  80.01027   67.38407
1496
            L       a.x          b
1497
[3,] 71.91841 -73.33548   70.41134
1497
[1,]  0.00000   0.00000    0.00000
1498
[4,] 32.24075  78.82042 -107.93632
1498
[2,] 53.48418  80.01027   67.38407
1499
[5,] 91.01106 -48.46075  -14.29081
1499
[3,] 71.91841 -73.33548   70.41134
1500
[6,] 60.50231  97.95195  -60.51490
1500
[4,] 32.24075  78.82042 -107.93632
1501
[7,] 97.14950 -21.36677   94.42044
1501
[5,] 91.01106 -48.46075  -14.29081
1502
[8,] 76.97594   0.00000    0.00000
1502
[6,] 60.50231  97.95195  -60.51490
1503
> round(convertColor(lab,from="Lab",to="sRGB",scale.out=255))
1503
[7,] 97.14950 -21.36677   94.42044
1504
     [,1] [,2] [,3]
1504
[8,] 76.97594   0.00000    0.00000
1505
[1,]    0    0    0
1505
> round(convertColor(lab,from="Lab",to="sRGB",scale.out=255))
1506
[2,]  255    0    0
1506
     [,1] [,2] [,3]
1507
[3,]    0  205    0
1507
[1,]    0    0    0
1508
[4,]    0    0  255
1508
[2,]  255    0    0
1509
[5,]    0  255  255
1509
[3,]    0  205    0
1510
[6,]  255    0  255
1510
[4,]    0    0  255
1511
[7,]  255  255    0
1511
[5,]    0  255  255
1512
[8,]  190  190  190
1512
[6,]  255    0  255
1513
> 
1513
[7,]  255  255    0
1514
> 
1514
[8,]  190  190  190
1515
> 
1515
> 
1516
> graphics::par(get("par.postscript", pos = 'CheckExEnv'))
1516
> 
1517
> cleanEx()
1517
> 
1518
> nameEx("densCols")
1518
> graphics::par(get("par.postscript", pos = 'CheckExEnv'))
1519
> ### * densCols
1519
> cleanEx()
1520
> 
1520
> nameEx("densCols")
1521
> flush(stderr()); flush(stdout())
1521
> ### * densCols
1522
> 
1522
> 
1523
> ### Name: densCols
1523
> flush(stderr()); flush(stdout())
1524
> ### Title: Colors for Smooth Density Plots
1524
> 
1525
> ### Aliases: densCols blues9
1525
> ### Name: densCols
1526
> ### Keywords: dplot
1526
> ### Title: Colors for Smooth Density Plots
1527
> 
1527
> ### Aliases: densCols blues9
1528
> ### ** Examples
1528
> ### Keywords: dplot
1529
> 
1529
> 
1530
> x1  <- matrix(rnorm(1e3), ncol=2)
1530
> ### ** Examples
1531
> x2  <- matrix(rnorm(1e3, mean=3, sd=1.5), ncol=2)
1531
> 
1532
> x   <- rbind(x1,x2)
1532
> x1  <- matrix(rnorm(1e3), ncol=2)
1533
> 
1533
> x2  <- matrix(rnorm(1e3, mean=3, sd=1.5), ncol=2)
1534
> dcols <- densCols(x)
1534
> x   <- rbind(x1,x2)
1535
KernSmooth 2.23 loaded
1535
> 
1536
Copyright M. P. Wand 1997-2009
1536
> dcols <- densCols(x)
1537
> graphics::plot(x, col = dcols, pch=20, main = "n = 1000")
1537
KernSmooth 2.23 loaded
1538
> 
1538
Copyright M. P. Wand 1997-2009
1539
> 
1539
> graphics::plot(x, col = dcols, pch=20, main = "n = 1000")
1540
> 
1540
> 
1541
> cleanEx()
1541
> 
1542
> nameEx("dev")
1542
> 
1543
> ### * dev
1543
> cleanEx()
1544
> 
1544
> nameEx("dev")
1545
> flush(stderr()); flush(stdout())
1545
> ### * dev
1546
> 
1546
> 
1547
> ### Name: dev
1547
> flush(stderr()); flush(stdout())
1548
> ### Title: Control Multiple Devices
1548
> 
1549
> ### Aliases: dev.cur dev.list dev.next dev.prev dev.off dev.set dev.new
1549
> ### Name: dev
1550
> ###   graphics.off
1550
> ### Title: Control Multiple Devices
1551
> ### Keywords: device iplot
1551
> ### Aliases: dev.cur dev.list dev.next dev.prev dev.off dev.set dev.new
1552
> 
1552
> ###   graphics.off
1553
> ### ** Examples
1553
> ### Keywords: device iplot
1554
> 
1554
> 
1555
> ## Not run: 
1555
> ### ** Examples
1556
> ##D ## Unix-specific example
1556
> 
1557
> ##D x11()
1557
> ## Not run: 
1558
> ##D plot(1:10)
1558
> ##D ## Unix-specific example
1559
> ##D x11()
1559
> ##D x11()
1560
> ##D plot(rnorm(10))
1560
> ##D plot(1:10)
1561
> ##D dev.set(dev.prev())
1561
> ##D x11()
1562
> ##D abline(0,1)# through the 1:10 points
1562
> ##D plot(rnorm(10))
1563
> ##D dev.set(dev.next())
1563
> ##D dev.set(dev.prev())
1564
> ##D abline(h=0, col="gray")# for the residual plot
1564
> ##D abline(0,1)# through the 1:10 points
1565
> ##D dev.set(dev.prev())
1565
> ##D dev.set(dev.next())
1566
> ##D dev.off(); dev.off()#- close the two X devices
1566
> ##D abline(h=0, col="gray")# for the residual plot
1567
> ## End(Not run)
1567
> ##D dev.set(dev.prev())
1568
> 
1568
> ##D dev.off(); dev.off()#- close the two X devices
1569
> 
1569
> ## End(Not run)
1570
> 
1570
> 
1571
> cleanEx()
1571
> 
1572
> nameEx("dev.interactive")
1572
> 
1573
> ### * dev.interactive
1573
> cleanEx()
1574
> 
1574
> nameEx("dev.interactive")
1575
> flush(stderr()); flush(stdout())
1575
> ### * dev.interactive
1576
> 
1576
> 
1577
> ### Name: dev.interactive
1577
> flush(stderr()); flush(stdout())
1578
> ### Title: Is the Current Graphics Device Interactive?
1578
> 
1579
> ### Aliases: dev.interactive deviceIsInteractive
1579
> ### Name: dev.interactive
1580
> ### Keywords: device
1580
> ### Title: Is the Current Graphics Device Interactive?
1581
> 
1581
> ### Aliases: dev.interactive deviceIsInteractive
1582
> ### ** Examples
1582
> ### Keywords: device
1583
> 
1583
> 
1584
> dev.interactive()
1584
> ### ** Examples
1585
[1] FALSE
1585
> 
1586
> print(deviceIsInteractive(NULL))
1586
> dev.interactive()
1587
[1] "X11"      "X11cairo" "quartz"   "windows"  "JavaGD"   "CairoWin" "CairoX11"
1587
[1] FALSE
1588
> 
1588
> print(deviceIsInteractive(NULL))
1589
> 
1589
[1] "X11"      "X11cairo" "quartz"   "windows"  "JavaGD"   "CairoWin" "CairoX11"
1590
> 
1590
> 
1591
> cleanEx()
1591
> 
1592
> nameEx("dev.size")
1592
> 
1593
> ### * dev.size
1593
> cleanEx()
1594
> 
1594
> nameEx("dev.size")
1595
> flush(stderr()); flush(stdout())
1595
> ### * dev.size
1596
> 
1596
> 
1597
> ### Name: dev.size
1597
> flush(stderr()); flush(stdout())
1598
> ### Title: Find Size of Device Surface
1598
> 
1599
> ### Aliases: dev.size
1599
> ### Name: dev.size
1600
> ### Keywords: dplot
1600
> ### Title: Find Size of Device Surface
1601
> 
1601
> ### Aliases: dev.size
1602
> ### ** Examples
1602
> ### Keywords: dplot
1603
> 
1603
> 
1604
> dev.size("cm")
1604
> ### ** Examples
1605
[1] 17.78 17.78
1605
> 
1606
> 
1606
> dev.size("cm")
1607
> 
1607
[1] 17.78 17.78
1608
> 
1608
> 
1609
> cleanEx()
1609
> 
1610
> nameEx("dev2")
1610
> 
1611
> ### * dev2
1611
> cleanEx()
1612
> 
1612
> nameEx("dev2")
1613
> flush(stderr()); flush(stdout())
1613
> ### * dev2
1614
> 
1614
> 
1615
> ### Name: dev2
1615
> flush(stderr()); flush(stdout())
1616
> ### Title: Copy Graphics Between Multiple Devices
1616
> 
1617
> ### Aliases: dev.copy dev.print dev.copy2eps dev.copy2pdf dev.control
1617
> ### Name: dev2
1618
> ### Keywords: device
1618
> ### Title: Copy Graphics Between Multiple Devices
1619
> 
1619
> ### Aliases: dev.copy dev.print dev.copy2eps dev.copy2pdf dev.control
1620
> ### ** Examples
1620
> ### Keywords: device
1621
> 
1621
> 
1622
> ## Not run: 
1622
> ### ** Examples
1623
> ##D x11()
1623
> 
1624
> ##D plot(rnorm(10), main="Plot 1")
1624
> ## Not run: 
1625
> ##D dev.copy(device=x11)
1625
> ##D x11()
1626
> ##D mtext("Copy 1", 3)
1626
> ##D plot(rnorm(10), main="Plot 1")
1627
> ##D dev.print(width=6, height=6, horizontal=FALSE) # prints it
1627
> ##D dev.copy(device=x11)
1628
> ##D dev.off(dev.prev())
1628
> ##D mtext("Copy 1", 3)
1629
> ##D dev.off()
1629
> ##D dev.print(width=6, height=6, horizontal=FALSE) # prints it
1630
> ## End(Not run)
1630
> ##D dev.off(dev.prev())
1631
> 
1631
> ##D dev.off()
1632
> 
1632
> ## End(Not run)
1633
> 
1633
> 
1634
> cleanEx()
1634
> 
1635
> nameEx("extendrange")
1635
> 
1636
> ### * extendrange
1636
> cleanEx()
1637
> 
1637
> nameEx("extendrange")
1638
> flush(stderr()); flush(stdout())
1638
> ### * extendrange
1639
> 
1639
> 
1640
> ### Name: extendrange
1640
> flush(stderr()); flush(stdout())
1641
> ### Title: Extend a Numerical Range by a Small Percentage
1641
> 
1642
> ### Aliases: extendrange
1642
> ### Name: extendrange
1643
> ### Keywords: dplot
1643
> ### Title: Extend a Numerical Range by a Small Percentage
1644
> 
1644
> ### Aliases: extendrange
1645
> ### ** Examples
1645
> ### Keywords: dplot
1646
> 
1646
> 
1647
> x <- 1:5
1647
> ### ** Examples
1648
> (r <- range(x))         # 1    5
1648
> 
1649
[1] 1 5
1649
> x <- 1:5
1650
> extendrange(x)          # 0.8  5.2
1650
> (r <- range(x))         # 1    5
1651
[1] 0.8 5.2
1651
[1] 1 5
1652
> extendrange(x, f= 0.01) # 0.96 5.04
1652
> extendrange(x)          # 0.8  5.2
1653
[1] 0.96 5.04
1653
[1] 0.8 5.2
1654
> ## Use 'r' if you have it already:
1654
> extendrange(x, f= 0.01) # 0.96 5.04
1655
> stopifnot(identical(extendrange(r=r),
1655
[1] 0.96 5.04
1656
+                     extendrange(x)))
1656
> ## Use 'r' if you have it already:
1657
> 
1657
> stopifnot(identical(extendrange(r=r),
1658
> 
1658
+                     extendrange(x)))
1659
> 
1659
> 
1660
> cleanEx()
1660
> 
1661
> nameEx("getGraphicsEvent")
1661
> 
1662
> ### * getGraphicsEvent
1662
> cleanEx()
1663
> 
1663
> nameEx("getGraphicsEvent")
1664
> flush(stderr()); flush(stdout())
1664
> ### * getGraphicsEvent
1665
> 
1665
> 
1666
> ### Name: getGraphicsEvent
1666
> flush(stderr()); flush(stdout())
1667
> ### Title: Wait for a mouse or keyboard event from a graphics window
1667
> 
1668
> ### Aliases: getGraphicsEvent
1668
> ### Name: getGraphicsEvent
1669
> ### Keywords: iplot
1669
> ### Title: Wait for a mouse or keyboard event from a graphics window
1670
> 
1670
> ### Aliases: getGraphicsEvent setGraphicsEventHandlers getGraphicsEventEnv
1671
> ### ** Examples
1671
> ###   setGraphicsEventEnv
1672
> 
1672
> ### Keywords: iplot
1673
> ## Not run: 
1673
> 
1674
> ##D     mousedown <- function(buttons, x, y) {
1674
> ### ** Examples
1675
> ##D         plx <- grconvertX(x, "ndc", "user")
1675
> 
1676
> ##D         ply <- grconvertY(y, "ndc", "user")    
1676
> 
1677
> ##D         cat("Buttons ", paste(buttons, collapse=" "), " at ndc",
1677
> 
1678
> ##D             x, y, "user", plx, ply, "\n")
1678
> 
1679
> ##D         points(plx, ply, col="red", pch=19, cex=2)
1679
> graphics::par(get("par.postscript", pos = 'CheckExEnv'))
1680
> ##D         if (x > 0.85 && y > 0.85) "Done"
1680
> cleanEx()
1681
> ##D         else NULL
1681
> nameEx("gray")
1682
> ##D     }
1682
> ### * gray
1683
> ##D     
1683
> 
1684
> ##D     mousemove <- function(buttons, x, y) {
1684
> flush(stderr()); flush(stdout())
1685
> ##D         plx <- grconvertX(x, "ndc", "user")
1685
> 
1686
> ##D         ply <- grconvertY(y, "ndc", "user")    
1686
> ### Name: gray
1687
> ##D         points(plx, ply)
1687
> ### Title: Gray Level Specification
1688
> ##D         NULL
1688
> ### Aliases: gray grey
1689
> ##D     }
1689
> ### Keywords: color
1690
> ##D     
1690
> 
1691
> ##D     keybd <- function(key) {
1691
> ### ** Examples
1692
> ##D         cat("Key <", key, ">\n", sep = "")
1692
> 
1693
> ##D     }
1693
> gray(0:8 / 8)
1694
> ##D     
1694
[1] "#000000" "#202020" "#404040" "#606060" "#808080" "#9F9F9F" "#BFBFBF"
1695
> ##D     plot(0:1, 0:1, type='n')
1695
[8] "#DFDFDF" "#FFFFFF"
1696
> ##D     getGraphicsEvent("Click on upper right to quit",
1696
> 
1697
> ##D                      onMouseDown = mousedown,
1697
> 
1698
> ##D                      onMouseMove = mousemove,
1698
> 
1699
> ##D                      onKeybd = keybd)
1699
> cleanEx()
1700
> ## End(Not run)
1700
> nameEx("gray.colors")
1701
> 
1701
> ### * gray.colors
1702
> 
1702
> 
1703
> 
1703
> flush(stderr()); flush(stdout())
1704
> cleanEx()
1704
> 
1705
> nameEx("gray")
1705
> ### Name: gray.colors
1706
> ### * gray
1706
> ### Title: Gray Color Palette
1707
> 
1707
> ### Aliases: gray.colors grey.colors
1708
> flush(stderr()); flush(stdout())
1708
> ### Keywords: color
1709
> 
1709
> 
1710
> ### Name: gray
1710
> ### ** Examples
1711
> ### Title: Gray Level Specification
1711
> 
1712
> ### Aliases: gray grey
1712
> require(graphics)
1713
> ### Keywords: color
1713
> 
1714
> 
1714
> pie(rep(1,12), col = gray.colors(12))
1715
> ### ** Examples
1715
> barplot(1:12, col = gray.colors(12))
1716
> 
1716
> 
1717
> gray(0:8 / 8)
1717
> 
1718
[1] "#000000" "#202020" "#404040" "#606060" "#808080" "#9F9F9F" "#BFBFBF"
1718
> 
1719
[8] "#DFDFDF" "#FFFFFF"
1719
> cleanEx()
1720
> 
1720
> nameEx("hcl")
1721
> 
1721
> ### * hcl
1722
> 
1722
> 
1723
> cleanEx()
1723
> flush(stderr()); flush(stdout())
1724
> nameEx("gray.colors")
1724
> 
1725
> ### * gray.colors
1725
> ### Name: hcl
1726
> 
1726
> ### Title: HCL Color Specification
1727
> flush(stderr()); flush(stdout())
1727
> ### Aliases: hcl
1728
> 
1728
> ### Keywords: color dplot
1729
> ### Name: gray.colors
1729
> 
1730
> ### Title: Gray Color Palette
1730
> ### ** Examples
1731
> ### Aliases: gray.colors grey.colors
1731
> 
1732
> ### Keywords: color
1732
> require(graphics)
1733
> 
1733
> 
1734
> ### ** Examples
1734
> # The Foley and Van Dam PhD Data.
1735
> 
1735
> csd <- matrix(c( 4,2,4,6, 4,3,1,4, 4,7,7,1,
1736
> require(graphics)
1736
+                  0,7,3,2, 4,5,3,2, 5,4,2,2,
1737
> 
1737
+                  3,1,3,0, 4,4,6,7, 1,10,8,7,
1738
> pie(rep(1,12), col = gray.colors(12))
1738
+                  1,5,3,2, 1,5,2,1, 4,1,4,3,
1739
> barplot(1:12, col = gray.colors(12))
1739
+                  0,3,0,6, 2,1,5,5), nrow=4)
1740
> 
1740
> 
1741
> 
1741
> csphd <- function(colors)
1742
> 
1742
+   barplot(csd, col = colors, ylim = c(0,30),
1743
> cleanEx()
1743
+           names = 72:85, xlab = "Year", ylab = "Students",
1744
> nameEx("hcl")
1744
+           legend = c("Winter", "Spring", "Summer", "Fall"),
1745
> ### * hcl
1745
+           main = "Computer Science PhD Graduates", las = 1)
1746
> 
1746
> 
1747
> flush(stderr()); flush(stdout())
1747
> # The Original (Metaphorical) Colors (Ouch!)
1748
> 
1748
> csphd(c("blue", "green", "yellow", "orange"))
1749
> ### Name: hcl
1749
> 
1750
> ### Title: HCL Color Specification
1750
> # A Color Tetrad (Maximal Color Differences)
1751
> ### Aliases: hcl
1751
> csphd(hcl(h = c(30, 120, 210, 300)))
1752
> ### Keywords: color dplot
1752
> 
1753
> 
1753
> # Same, but lighter and less colorful
1754
> ### ** Examples
1754
> # Turn of automatic correction to make sure
1755
> 
1755
> # that we have defined real colors.
1756
> require(graphics)
1756
> csphd(hcl(h = c(30, 120, 210, 300),
1757
> 
1757
+           c = 20, l = 90, fixup = FALSE))
1758
> # The Foley and Van Dam PhD Data.
1758
> 
1759
> csd <- matrix(c( 4,2,4,6, 4,3,1,4, 4,7,7,1,
1759
> # Analogous Colors
1760
+                  0,7,3,2, 4,5,3,2, 5,4,2,2,
1760
> # Good for those with red/green color confusion
1761
+                  3,1,3,0, 4,4,6,7, 1,10,8,7,
1761
> csphd(hcl(h = seq(60, 240, by = 60)))
1762
+                  1,5,3,2, 1,5,2,1, 4,1,4,3,
1762
> 
1763
+                  0,3,0,6, 2,1,5,5), nrow=4)
1763
> # Metaphorical Colors
1764
> 
1764
> csphd(hcl(h = seq(210, 60, length = 4)))
1765
> csphd <- function(colors)
1765
> 
1766
+   barplot(csd, col = colors, ylim = c(0,30),
1766
> # Cool Colors
1767
+           names = 72:85, xlab = "Year", ylab = "Students",
1767
> csphd(hcl(h = seq(120, 0, length = 4) + 150))
1768
+           legend = c("Winter", "Spring", "Summer", "Fall"),
1768
> 
1769
+           main = "Computer Science PhD Graduates", las = 1)
1769
> # Warm Colors
1770
> 
1770
> csphd(hcl(h = seq(120, 0, length = 4) - 30))
1771
> # The Original (Metaphorical) Colors (Ouch!)
1771
> 
1772
> csphd(c("blue", "green", "yellow", "orange"))
1772
> # Single Color
1773
> 
1773
> hist(stats::rnorm(1000), col = hcl(240))
1774
> # A Color Tetrad (Maximal Color Differences)
1774
> 
1775
> csphd(hcl(h = c(30, 120, 210, 300)))
1775
> 
1776
> 
1776
> 
1777
> # Same, but lighter and less colorful
1777
> cleanEx()
1778
> # Turn of automatic correction to make sure
1778
> nameEx("hsv")
1779
> # that we have defined real colors.
1779
> ### * hsv
1780
> csphd(hcl(h = c(30, 120, 210, 300),
1780
> 
1781
+           c = 20, l = 90, fixup = FALSE))
1781
> flush(stderr()); flush(stdout())
1782
> 
1782
> 
1783
> # Analogous Colors
1783
> ### Name: hsv
1784
> # Good for those with red/green color confusion
1784
> ### Title: HSV Color Specification
1785
> csphd(hcl(h = seq(60, 240, by = 60)))
1785
> ### Aliases: hsv
1786
> 
1786
> ### Keywords: color dplot
1787
> # Metaphorical Colors
1787
> 
1788
> csphd(hcl(h = seq(210, 60, length = 4)))
1788
> ### ** Examples
1789
> 
1789
> 
1790
> # Cool Colors
1790
> require(graphics)
1791
> csphd(hcl(h = seq(120, 0, length = 4) + 150))
1791
> 
1792
> 
1792
> hsv(.5,.5,.5)
1793
> # Warm Colors
1793
[1] "#408080"
1794
> csphd(hcl(h = seq(120, 0, length = 4) - 30))
1794
> 
1795
> 
1795
> ## Look at gamma effect:
1796
> # Single Color
1796
> n <- 20;  y <- -sin(3*pi*((1:n)-1/2)/n)
1797
> hist(stats::rnorm(1000), col = hcl(240))
1797
> op <- par(mfrow=c(3,2),mar=rep(1.5,4))
1798
> 
1798
> for(gamma in c(.4, .6, .8, 1, 1.2, 1.5))
1799
> 
1799
+   plot(y, axes = FALSE, frame.plot = TRUE,
1800
> 
1800
+        xlab = "", ylab = "", pch = 21, cex = 30,
1801
> cleanEx()
1801
+        bg = rainbow(n, start=.85, end=.1, gamma = gamma),
1802
> nameEx("hsv")
1802
+        main = paste("Red tones;  gamma=",format(gamma)))
1803
> ### * hsv
1803
> par(op)
1804
> 
1804
> 
1805
> flush(stderr()); flush(stdout())
1805
> 
1806
> 
1806
> 
1807
> ### Name: hsv
1807
> graphics::par(get("par.postscript", pos = 'CheckExEnv'))
1808
> ### Title: HSV Color Specification
1808
> cleanEx()
1809
> ### Aliases: hsv
1809
> nameEx("make.rgb")
1810
> ### Keywords: color dplot
1810
> ### * make.rgb
1811
> 
1811
> 
1812
> ### ** Examples
1812
> flush(stderr()); flush(stdout())
1813
> 
1813
> 
1814
> require(graphics)
1814
> ### Name: make.rgb
1815
> 
1815
> ### Title: Create colour spaces
1816
> hsv(.5,.5,.5)
1816
> ### Aliases: make.rgb colorConverter
1817
[1] "#408080"
1817
> ### Keywords: color
1818
> 
1818
> 
1819
> ## Look at gamma effect:
1819
> ### ** Examples
1820
> n <- 20;  y <- -sin(3*pi*((1:n)-1/2)/n)
1820
> 
1821
> op <- par(mfrow=c(3,2),mar=rep(1.5,4))
1821
> (pal <- make.rgb(red=  c(0.6400,0.3300),
1822
> for(gamma in c(.4, .6, .8, 1, 1.2, 1.5))
1822
+                  green=c(0.2900,0.6000),
1823
+   plot(y, axes = FALSE, frame.plot = TRUE,
1823
+                  blue= c(0.1500,0.0600),
1824
+        xlab = "", ylab = "", pch = 21, cex = 30,
1824
+                  name = "PAL/SECAM RGB"))
1825
+        bg = rainbow(n, start=.85, end=.1, gamma = gamma),
1825
Color space converter: PAL/SECAM RGB
1826
+        main = paste("Red tones;  gamma=",format(gamma)))
1826
Reference white: D65
1827
> par(op)
1827
display gamma = 2.2
1828
> 
1828
> 
1829
> 
1829
> ## converter for sRGB in #rrggbb format
1830
> 
1830
> hexcolor <- colorConverter(toXYZ = function(hex,...) {
1831
> graphics::par(get("par.postscript", pos = 'CheckExEnv'))
1831
+                             rgb <- t(col2rgb(hex))/255
1832
> cleanEx()
1832
+                             colorspaces$sRGB$toXYZ(rgb,...) },
1833
> nameEx("make.rgb")
1833
+                            fromXYZ = function(xyz,...) {
1834
> ### * make.rgb
1834
+                               rgb <- colorspaces$sRGB$fromXYZ(xyz,..)
1835
> 
1835
+                               rgb <- round(rgb,5)
1836
> flush(stderr()); flush(stdout())
1836
+                               if (min(rgb) < 0 || max(rgb) > 1)
1837
> 
1837
+                                    as.character(NA)
1838
> ### Name: make.rgb
1838
+                               else
1839
> ### Title: Create colour spaces
1839
+                                    rgb(rgb[1],rgb[2],rgb[3])},
1840
> ### Aliases: make.rgb colorConverter
1840
+                            white = "D65", name = "#rrggbb")
1841
> ### Keywords: color
1841
> 
1842
> 
1842
> (cols <- t(col2rgb(palette())))
1843
> ### ** Examples
1843
     red green blue
1844
> 
1844
[1,]   0     0    0
1845
> (pal <- make.rgb(red=  c(0.6400,0.3300),
1845
[2,] 255     0    0
1846
+                  green=c(0.2900,0.6000),
1846
[3,]   0   205    0
1847
+                  blue= c(0.1500,0.0600),
1847
[4,]   0     0  255
1848
+                  name = "PAL/SECAM RGB"))
1848
[5,]   0   255  255
1849
Color space converter: PAL/SECAM RGB
1849
[6,] 255     0  255
1850
Reference white: D65
1850
[7,] 255   255    0
1851
display gamma = 2.2
1851
[8,] 190   190  190
1852
> 
1852
> (luv <- convertColor(cols,from="sRGB", to="Luv", scale.in=255))
1853
> ## converter for sRGB in #rrggbb format
1853
            L             u             v
1854
> hexcolor <- colorConverter(toXYZ = function(hex,...) {
1854
[1,]  0.00000  0.000000e+00  0.000000e+00
1855
+                             rgb <- t(col2rgb(hex))/255
1855
[2,] 53.48418  1.753647e+02  3.780017e+01
1856
+                             colorspaces$sRGB$toXYZ(rgb,...) },
1856
[3,] 71.91841 -6.870661e+01  8.786408e+01
1857
+                            fromXYZ = function(xyz,...) {
1857
[4,] 32.24075 -9.660595e+00 -1.301930e+02
1858
+                               rgb <- colorspaces$sRGB$fromXYZ(xyz,..)
1858
[5,] 91.01106 -7.117303e+01 -1.534147e+01
1859
+                               rgb <- round(rgb,5)
1859
[6,] 60.50231  8.456678e+01 -1.081465e+02
1860
+                               if (min(rgb) < 0 || max(rgb) > 1)
1860
[7,] 97.14950  7.898148e+00  1.064410e+02
1861
+                                    as.character(NA)
1861
[8,] 76.97594 -2.777465e-14 -5.554930e-14
1862
+                               else
1862
> (hex <- convertColor(luv, from="Luv",  to=hexcolor, scale.out=NULL))
1863
+                                    rgb(rgb[1],rgb[2],rgb[3])},
1863
[1] "#000000" "#FF0000" "#00CD00" "#0000FF" "#00FFFF" "#FF00FF" "#FFFF00"
1864
+                            white = "D65", name = "#rrggbb")
1864
[8] "#BEBEBE"
1865
> 
1865
> 
1866
> (cols <- t(col2rgb(palette())))
1866
> ## must make hex a matrix before using it
1867
     red green blue
1867
> (cc <- round(convertColor(as.matrix(hex), from= hexcolor, to= "sRGB",
1868
[1,]   0     0    0
1868
+                           scale.in=NULL, scale.out=255)))
1869
[2,] 255     0    0
1869
     [,1] [,2] [,3]
1870
[3,]   0   205    0
1870
[1,]    0    0    0
1871
[4,]   0     0  255
1871
[2,]  255    0    0
1872
[5,]   0   255  255
1872
[3,]    0  205    0
1873
[6,] 255     0  255
1873
[4,]    0    0  255
1874
[7,] 255   255    0
1874
[5,]    0  255  255
1875
[8,] 190   190  190
1875
[6,]  255    0  255
1876
> (luv <- convertColor(cols,from="sRGB", to="Luv", scale.in=255))
1876
[7,]  255  255    0
1877
            L             u             v
1877
[8,]  190  190  190
1878
[1,]  0.00000  0.000000e+00  0.000000e+00
1878
> stopifnot(cc == cols)
1879
[2,] 53.48418  1.753647e+02  3.780017e+01
1879
> 
1880
[3,] 71.91841 -6.870661e+01  8.786408e+01
1880
> 
1881
[4,] 32.24075 -9.660595e+00 -1.301930e+02
1881
> 
1882
[5,] 91.01106 -7.117303e+01 -1.534147e+01
1882
> cleanEx()
1883
[6,] 60.50231  8.456678e+01 -1.081465e+02
1883
> nameEx("n2mfrow")
1884
[7,] 97.14950  7.898148e+00  1.064410e+02
1884
> ### * n2mfrow
1885
[8,] 76.97594 -2.777465e-14 -5.554930e-14
1885
> 
1886
> (hex <- convertColor(luv, from="Luv",  to=hexcolor, scale.out=NULL))
1886
> flush(stderr()); flush(stdout())
1887
[1] "#000000" "#FF0000" "#00CD00" "#0000FF" "#00FFFF" "#FF00FF" "#FFFF00"
1887
> 
1888
[8] "#BEBEBE"
1888
> ### Name: n2mfrow
1889
> 
1889
> ### Title: Compute Default mfrow From Number of Plots
1890
> ## must make hex a matrix before using it
1890
> ### Aliases: n2mfrow
1891
> (cc <- round(convertColor(as.matrix(hex), from= hexcolor, to= "sRGB",
1891
> ### Keywords: dplot utilities
1892
+                           scale.in=NULL, scale.out=255)))
1892
> 
1893
     [,1] [,2] [,3]
1893
> ### ** Examples
1894
[1,]    0    0    0
1894
> 
1895
[2,]  255    0    0
1895
> require(graphics)
1896
[3,]    0  205    0
1896
> 
1897
[4,]    0    0  255
1897
> n2mfrow(8) # 3 x 3
1898
[5,]    0  255  255
1898
[1] 3 3
1899
[6,]  255    0  255
1899
> 
1900
[7,]  255  255    0
1900
> n <- 5 ; x <- seq(-2,2, len=51)
1901
[8,]  190  190  190
1901
> ## suppose now that 'n' is not known {inside function}
1902
> stopifnot(cc == cols)
1902
> op <- par(mfrow = n2mfrow(n))
1903
> 
1903
> for (j in 1:n)
1904
> 
1904
+    plot(x, x^j, main = substitute(x^ exp, list(exp = j)), type = "l",
1905
> 
1905
+    col = "blue")
1906
> cleanEx()
1906
> 
1907
> nameEx("n2mfrow")
1907
> sapply(1:10, n2mfrow)
1908
> ### * n2mfrow
1908
     [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
1909
> 
1909
[1,]    1    2    3    2    3    3    3    3    3     4
1910
> flush(stderr()); flush(stdout())
1910
[2,]    1    1    1    2    2    2    3    3    3     3
1911
> 
1911
> 
1912
> ### Name: n2mfrow
1912
> 
1913
> ### Title: Compute Default mfrow From Number of Plots
1913
> 
1914
> ### Aliases: n2mfrow
1914
> graphics::par(get("par.postscript", pos = 'CheckExEnv'))
1915
> ### Keywords: dplot utilities
1915
> cleanEx()
1916
> 
1916
> nameEx("nclass")
1917
> ### ** Examples
1917
> ### * nclass
1918
> 
1918
> 
1919
> require(graphics)
1919
> flush(stderr()); flush(stdout())
1920
> 
1920
> 
1921
> n2mfrow(8) # 3 x 3
1921
> ### Name: nclass
1922
[1] 3 3
1922
> ### Title: Compute the Number of Classes for a Histogram
1923
> 
1923
> ### Aliases: nclass.Sturges nclass.scott nclass.FD
1924
> n <- 5 ; x <- seq(-2,2, len=51)
1924
> ### Keywords: univar
1925
> ## suppose now that 'n' is not known {inside function}
1925
> 
1926
> op <- par(mfrow = n2mfrow(n))
1926
> ### ** Examples
1927
> for (j in 1:n)
1927
> 
1928
+    plot(x, x^j, main = substitute(x^ exp, list(exp = j)), type = "l",
1928
> set.seed(1)
1929
+    col = "blue")
1929
> x <- stats::rnorm(1111)
1930
> 
1930
> nclass.Sturges(x)
1931
> sapply(1:10, n2mfrow)
1931
[1] 12
1932
     [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
1932
> 
1933
[1,]    1    2    3    2    3    3    3    3    3     4
1933
> ## Compare them:
1934
[2,]    1    1    1    2    2    2    3    3    3     3
1934
> NC <- function(x) c(Sturges = nclass.Sturges(x),
1935
> 
1935
+       Scott = nclass.scott(x), FD = nclass.FD(x))
1936
> 
1936
> NC(x)
1937
> 
1937
Sturges   Scott      FD 
1938
> graphics::par(get("par.postscript", pos = 'CheckExEnv'))
1938
     12      20      26 
1939
> cleanEx()
1939
> onePt <- rep(1, 11)
1940
> nameEx("nclass")
1940
> NC(onePt) # no longer gives NaN
1941
> ### * nclass
1941
Sturges   Scott      FD 
1942
> 
1942
      5       1       1 
1943
> flush(stderr()); flush(stdout())
1943
> 
1944
> 
1944
> 
1945
> ### Name: nclass
1945
> 
1946
> ### Title: Compute the Number of Classes for a Histogram
1946
> cleanEx()
1947
> ### Aliases: nclass.Sturges nclass.scott nclass.FD
1947
> nameEx("palette")
1948
> ### Keywords: univar
1948
> ### * palette
1949
> 
1949
> 
1950
> ### ** Examples
1950
> flush(stderr()); flush(stdout())
1951
> 
1951
> 
1952
> set.seed(1)
1952
> ### Name: palette
1953
> x <- stats::rnorm(1111)
1953
> ### Title: Set or View the Graphics Palette
1954
> nclass.Sturges(x)
1954
> ### Aliases: palette
1955
[1] 12
1955
> ### Keywords: color sysdata
1956
> 
1956
> 
1957
> ## Compare them:
1957
> ### ** Examples
1958
> NC <- function(x) c(Sturges = nclass.Sturges(x),
1958
> 
1959
+       Scott = nclass.scott(x), FD = nclass.FD(x))
1959
> require(graphics)
1960
> NC(x)
1960
> 
1961
Sturges   Scott      FD 
1961
> palette()               # obtain the current palette
1962
     12      20      26 
1962
[1] "black"   "red"     "green3"  "blue"    "cyan"    "magenta" "yellow" 
1963
> onePt <- rep(1, 11)
1963
[8] "gray"   
1964
> NC(onePt) # no longer gives NaN
1964
> palette(rainbow(6))     # six color rainbow
1965
Sturges   Scott      FD 
1965
> 
1966
      5       1       1 
1966
> (palette(gray(seq(0,.9,len=25)))) # gray scales; print old palette
1967
> 
1967
[1] "red"     "yellow"  "green"   "cyan"    "blue"    "magenta"
1968
> 
1968
> matplot(outer(1:100,1:30), type='l', lty=1,lwd=2, col=1:30,
1969
> 
1969
+         main = "Gray Scales Palette",
1970
> cleanEx()
1970
+         sub = "palette(gray(seq(0,.9,len=25)))")
1971
> nameEx("palette")
1971
> palette("default")      # reset back to the default
1972
> ### * palette
1972
> 
1973
> 
1973
> ## on a device where alpha-transparency is supported,
1974
> flush(stderr()); flush(stdout())
1974
> ##  use 'alpha = 0.3' transparency with the default palette :
1975
> 
1975
> opal <- col2rgb(palette(), alpha=TRUE)/255; opal["alpha",] <- 0.3
1976
> ### Name: palette
1976
> mycols <- do.call(rgb, as.list(as.data.frame(t(opal))))
1977
> ### Title: Set or View the Graphics Palette
1977
> opal <- palette(mycols)
1978
> ### Aliases: palette
1978
> x <- rnorm(1000); xy <- cbind(x, 3*x + rnorm(1000))
1979
> ### Keywords: color sysdata
1979
> plot (xy, lwd=2,
1980
> 
1980
+        main = "Alpha-Transparency Palette\n alpha = 0.3")
1981
> ### ** Examples
1981
> xy[,1] <- -xy[,1]
1982
> 
1982
> points(xy, col=8, pch=16, cex = 1.5)
1983
> require(graphics)
1983
Warning in plot.xy(xy.coords(x, y), type = type, ...) :
1984
> 
1984
  semi-transparency is not supported on this device: reported only once per page
1985
> palette()               # obtain the current palette
1985
> palette("default")
1986
[1] "black"   "red"     "green3"  "blue"    "cyan"    "magenta" "yellow" 
1986
> 
1987
[8] "gray"   
1987
> 
1988
> palette(rainbow(6))     # six color rainbow
1988
> 
1989
> 
1989
> cleanEx()
1990
> (palette(gray(seq(0,.9,len=25)))) # gray scales; print old palette
1990
> nameEx("palettes")
1991
[1] "red"     "yellow"  "green"   "cyan"    "blue"    "magenta"
1991
> ### * palettes
1992
> matplot(outer(1:100,1:30), type='l', lty=1,lwd=2, col=1:30,
1992
> 
1993
+         main = "Gray Scales Palette",
1993
> flush(stderr()); flush(stdout())
1994
+         sub = "palette(gray(seq(0,.9,len=25)))")
1994
> 
1995
> palette("default")      # reset back to the default
1995
> ### Name: Palettes
1996
> 
1996
> ### Title: Color Palettes
1997
> ## on a device where alpha-transparency is supported,
1997
> ### Aliases: rainbow heat.colors terrain.colors topo.colors cm.colors
1998
> ##  use 'alpha = 0.3' transparency with the default palette :
1998
> ### Keywords: color dplot
1999
> opal <- col2rgb(palette(), alpha=TRUE)/255; opal["alpha",] <- 0.3
1999
> 
2000
> mycols <- do.call(rgb, as.list(as.data.frame(t(opal))))
2000
> ### ** Examples
2001
> opal <- palette(mycols)
2001
> 
2002
> x <- rnorm(1000); xy <- cbind(x, 3*x + rnorm(1000))
2002
> require(graphics)
2003
> plot (xy, lwd=2,
2003
> # A Color Wheel
2004
+        main = "Alpha-Transparency Palette\n alpha = 0.3")
2004
> pie(rep(1,12), col=rainbow(12))
2005
> xy[,1] <- -xy[,1]
2005
> 
2006
> points(xy, col=8, pch=16, cex = 1.5)
2006
> ##------ Some palettes ------------
2007
Warning in plot.xy(xy.coords(x, y), type = type, ...) :
2007
> demo.pal <-
2008
  semi-transparency is not supported on this device: reported only once per page
2008
+   function(n, border = if (n<32) "light gray" else NA,
2009
> palette("default")
2009
+            main = paste("color palettes;  n=",n),
2010
> 
2010
+            ch.col = c("rainbow(n, start=.7, end=.1)", "heat.colors(n)",
2011
> 
2011
+                       "terrain.colors(n)", "topo.colors(n)",
2012
> 
2012
+                       "cm.colors(n)"))
2013
> cleanEx()
2013
+ {
2014
> nameEx("palettes")
2014
+     nt <- length(ch.col)
2015
> ### * palettes
2015
+     i <- 1:n; j <- n / nt; d <- j/6; dy <- 2*d
2016
> 
2016
+     plot(i,i+d, type="n", yaxt="n", ylab="", main=main)
2017
> flush(stderr()); flush(stdout())
2017
+     for (k in 1:nt) {
2018
> 
2018
+         rect(i-.5, (k-1)*j+ dy, i+.4, k*j,
2019
> ### Name: Palettes
2019
+              col = eval(parse(text=ch.col[k])), border = border)
2020
> ### Title: Color Palettes
2020
+         text(2*j,  k * j +dy/4, ch.col[k])
2021
> ### Aliases: rainbow heat.colors terrain.colors topo.colors cm.colors
2021
+     }
2022
> ### Keywords: color dplot
2022
+ }
2023
> 
2023
> n <- if(.Device == "postscript") 64 else 16
2024
> ### ** Examples
2024
>      # Since for screen, larger n may give color allocation problem
2025
> 
2025
> demo.pal(n)
2026
> require(graphics)
2026
> 
2027
> # A Color Wheel
2027
> 
2028
> pie(rep(1,12), col=rainbow(12))
2028
> 
2029
> 
2029
> cleanEx()
2030
> ##------ Some palettes ------------
2030
> nameEx("pdf")
2031
> demo.pal <-
2031
> ### * pdf
2032
+   function(n, border = if (n<32) "light gray" else NA,
2032
> 
2033
+            main = paste("color palettes;  n=",n),
2033
> flush(stderr()); flush(stdout())
2034
+            ch.col = c("rainbow(n, start=.7, end=.1)", "heat.colors(n)",
2034
> 
2035
+                       "terrain.colors(n)", "topo.colors(n)",
2035
> ### Name: pdf
2036
+                       "cm.colors(n)"))
2036
> ### Title: PDF Graphics Device
2037
+ {
2037
> ### Aliases: pdf
2038
+     nt <- length(ch.col)
2038
> ### Keywords: device
2039
+     i <- 1:n; j <- n / nt; d <- j/6; dy <- 2*d
2039
> 
2040
+     plot(i,i+d, type="n", yaxt="n", ylab="", main=main)
2040
> ### ** Examples
2041
+     for (k in 1:nt) {
2041
> 
2042
+         rect(i-.5, (k-1)*j+ dy, i+.4, k*j,
2042
> ## Not run: 
2043
+              col = eval(parse(text=ch.col[k])), border = border)
2043
> ##D ## Test function for encodings
2044
+         text(2*j,  k * j +dy/4, ch.col[k])
2044
> ##D TestChars <- function(encoding="ISOLatin1", ...)
2045
+     }
2045
> ##D {
2046
+ }
2046
> ##D     pdf(encoding=encoding, ...)
2047
> n <- if(.Device == "postscript") 64 else 16
2047
> ##D     par(pty="s")
2048
>      # Since for screen, larger n may give color allocation problem
2048
> ##D     plot(c(-1,16), c(-1,16), type="n", xlab="", ylab="",
2049
> demo.pal(n)
2049
> ##D          xaxs="i", yaxs="i")
2050
> 
2050
> ##D          title(paste("Centred chars in encoding", encoding))
2051
> 
2051
> ##D     grid(17, 17, lty=1)
2052
> 
2052
> ##D     for(i in c(32:255)) {
2053
> cleanEx()
2053
> ##D         x <- i %% 16
2054
> nameEx("pdf")
2054
> ##D         y <- i %/% 16
2055
> ### * pdf
2055
> ##D         points(x, y, pch=i)
2056
> 
2056
> ##D     }
2057
> flush(stderr()); flush(stdout())
2057
> ##D     dev.off()
2058
> 
2058
> ##D }
2059
> ### Name: pdf
2059
> ##D ## there will be many warnings.
2060
> ### Title: PDF Graphics Device
2060
> ##D TestChars("ISOLatin2")
2061
> ### Aliases: pdf
2061
> ##D ## this does not view properly in older viewers.
2062
> ### Keywords: device
2062
> ##D TestChars("ISOLatin2", family="URWHelvetica")
2063
> 
2063
> ##D ## works well for viewing in gs-based viewers, and often in xpdf.
2064
> ### ** Examples
2064
> ## End(Not run)
2065
> 
2065
> 
2066
> ## Not run: 
2066
> 
2067
> ##D ## Test function for encodings
2067
> cleanEx()
2068
> ##D TestChars <- function(encoding="ISOLatin1", ...)
2068
> nameEx("pdf.options")
2069
> ##D {
2069
> ### * pdf.options
2070
> ##D     pdf(encoding=encoding, ...)
2070
> 
2071
> ##D     par(pty="s")
2071
> flush(stderr()); flush(stdout())
2072
> ##D     plot(c(-1,16), c(-1,16), type="n", xlab="", ylab="",
2072
> 
2073
> ##D          xaxs="i", yaxs="i")
2073
> ### Name: pdf.options
2074
> ##D          title(paste("Centred chars in encoding", encoding))
2074
> ### Title: Auxiliary Function to Set/View Defaults for Arguments of pdf
2075
> ##D     grid(17, 17, lty=1)
2075
> ### Aliases: pdf.options
2076
> ##D     for(i in c(32:255)) {
2076
> ### Keywords: device
2077
> ##D         x <- i %% 16
2077
> 
2078
> ##D         y <- i %/% 16
2078
> ### ** Examples
2079
> ##D         points(x, y, pch=i)
2079
> 
2080
> ##D     }
2080
> pdf.options(bg = "pink")
2081
> ##D     dev.off()
2081
> utils::str(pdf.options())
2082
> ##D }
2082
List of 18
2083
> ##D ## there will be many warnings.
2083
 $ width      : num 7
2084
> ##D TestChars("ISOLatin2")
2084
 $ height     : num 7
2085
> ##D ## this does not view properly in older viewers.
2085
 $ onefile    : logi TRUE
2086
> ##D TestChars("ISOLatin2", family="URWHelvetica")
2086
 $ family     : chr "Helvetica"
2087
> ##D ## works well for viewing in gs-based viewers, and often in xpdf.
2087
 $ title      : chr "R Graphics Output"
2088
> ## End(Not run)
2088
 $ fonts      : NULL
2089
> 
2089
 $ version    : chr "1.4"
2090
> 
2090
 $ paper      : chr "special"
2091
> cleanEx()
2091
 $ encoding   : chr "default"
2092
> nameEx("pdf.options")
2092
 $ bg         : chr "pink"
2093
> ### * pdf.options
2093
 $ fg         : chr "black"
2094
> 
2094
 $ pointsize  : num 12
2095
> flush(stderr()); flush(stdout())
2095
 $ pagecentre : logi TRUE
2096
> 
2096
 $ colormodel : chr "rgb"
2097
> ### Name: pdf.options
2097
 $ useDingbats: logi TRUE
2098
> ### Title: Auxiliary Function to Set/View Defaults for Arguments of pdf
2098
 $ useKerning : logi TRUE
2099
> ### Aliases: pdf.options
2099
 $ fillOddEven: logi FALSE
2100
> ### Keywords: device
2100
 $ maxRasters : num 64
2101
> 
2101
> pdf.options(reset = TRUE) # back to factory-fresh
2102
> ### ** Examples
2102
> 
2103
> 
2103
> 
2104
> pdf.options(bg = "pink")
2104
> 
2105
> utils::str(pdf.options())
2105
> cleanEx()
2106
List of 18
2106
> nameEx("pictex")
2107
 $ width      : num 7
2107
> ### * pictex
2108
 $ height     : num 7
2108
> 
2109
 $ onefile    : logi TRUE
2109
> flush(stderr()); flush(stdout())
2110
 $ family     : chr "Helvetica"
2110
> 
2111
 $ title      : chr "R Graphics Output"
2111
> ### Name: pictex
2112
 $ fonts      : NULL
2112
> ### Title: A PicTeX Graphics Driver
2113
 $ version    : chr "1.4"
2113
> ### Aliases: pictex
2114
 $ paper      : chr "special"
2114
> ### Keywords: device
2115
 $ encoding   : chr "default"
2115
> 
2116
 $ bg         : chr "pink"
2116
> ### ** Examples
2117
 $ fg         : chr "black"
2117
> 
2118
 $ pointsize  : num 12
2118
> require(graphics)
2119
 $ pagecentre : logi TRUE
2119
> 
2120
 $ colormodel : chr "rgb"
2120
> pictex()
2121
 $ useDingbats: logi TRUE
2121
> plot(1:11,(-5:5)^2, type='b', main="Simple Example Plot")
2122
 $ useKerning : logi TRUE
2122
> dev.off()
2123
 $ fillOddEven: logi FALSE
2123
postscript 
2124
 $ maxRasters : num 64
2124
         2 
2125
> pdf.options(reset = TRUE) # back to factory-fresh
2125
> ##--------------------
2126
> 
2126
> ## Not run: 
2127
> 
2127
> ##D %% LaTeX Example
2128
> 
2128
> ##D \documentclass{article}
2129
> cleanEx()
2129
> ##D \usepackage{pictex}
2130
> nameEx("pictex")
2130
> ##D \usepackage{graphics} % for \rotatebox
2131
> ### * pictex
2131
> ##D \begin{document}
2132
> 
2132
> ##D %...
2133
> flush(stderr()); flush(stdout())
2133
> ##D \begin{figure}[h]
2134
> 
2134
> ##D   \centerline{\input{Rplots.tex}}
2135
> ### Name: pictex
2135
> ##D   \caption{}
2136
> ### Title: A PicTeX Graphics Driver
2136
> ##D \end{figure}
2137
> ### Aliases: pictex
2137
> ##D %...
2138
> ### Keywords: device
2138
> ##D \end{document}
2139
> 
2139
> ## End(Not run)
2140
> ### ** Examples
2140
> ##--------------------
2141
> 
2141
> unlink("Rplots.tex")
2142
> require(graphics)
2142
> 
2143
> 
2143
> 
2144
> pictex()
2144
> 
2145
> plot(1:11,(-5:5)^2, type='b', main="Simple Example Plot")
2145
> cleanEx()
2146
> dev.off()
2146
> nameEx("plotmath")
2147
postscript 
2147
> ### * plotmath
2148
         2 
2148
> 
2149
> ##--------------------
2149
> flush(stderr()); flush(stdout())
2150
> ## Not run: 
2150
> 
2151
> ##D %% LaTeX Example
2151
> ### Name: plotmath
2152
> ##D \documentclass{article}
2152
> ### Title: Mathematical Annotation in R
2153
> ##D \usepackage{pictex}
2153
> ### Aliases: plotmath symbol plain bold italic bolditalic hat bar dot ring
2154
> ##D \usepackage{graphics} % for \rotatebox
2154
> ###   widehat widetilde displaystyle textstyle scriptstyle
2155
> ##D \begin{document}
2155
> ###   scriptscriptstyle underline phantom over frac atop integral inf sup
2156
> ##D %...
2156
> ###   group bgroup
2157
> ##D \begin{figure}[h]
2157
> ### Keywords: aplot
2158
> ##D   \centerline{\input{Rplots.tex}}
2158
> 
2159
> ##D   \caption{}
2159
> ### ** Examples
2160
> ##D \end{figure}
2160
> 
2161
> ##D %...
2161
> require(graphics)
2162
> ##D \end{document}
2162
> 
2163
> ## End(Not run)
2163
> x <- seq(-4, 4, len = 101)
2164
> ##--------------------
2164
> y <- cbind(sin(x), cos(x))
2165
> unlink("Rplots.tex")
2165
> matplot(x, y, type = "l", xaxt = "n",
2166
> 
2166
+         main = expression(paste(plain(sin) * phi, "  and  ",
2167
> 
2167
+                                 plain(cos) * phi)),
2168
> 
2168
+         ylab = expression("sin" * phi, "cos" * phi), # only 1st is taken
2169
> cleanEx()
2169
+         xlab = expression(paste("Phase Angle ", phi)),
2170
> nameEx("plotmath")
2170
+         col.main = "blue")
2171
> ### * plotmath
2171
> axis(1, at = c(-pi, -pi/2, 0, pi/2, pi),
2172
> 
2172
+      labels = expression(-pi, -pi/2, 0, pi/2, pi))
2173
> flush(stderr()); flush(stdout())
2173
> 
2174
> 
2174
> 
2175
> ### Name: plotmath
2175
> ## How to combine "math" and numeric variables :
2176
> ### Title: Mathematical Annotation in R
2176
> plot(1:10, type="n", xlab="", ylab="", main = "plot math & numbers")
2177
> ### Aliases: plotmath symbol plain bold italic bolditalic hat bar dot ring
2177
> theta <- 1.23 ; mtext(bquote(hat(theta) == .(theta)), line= .25)
2178
> ###   widehat widetilde displaystyle textstyle scriptstyle
2178
> for(i in 2:9)
2179
> ###   scriptscriptstyle underline phantom over frac atop integral inf sup
2179
+     text(i,i+1, substitute(list(xi,eta) == group("(",list(x,y),")"),
2180
> ###   group bgroup
2180
+                            list(x=i, y=i+1)))
2181
> ### Keywords: aplot
2181
> ## note that both of these use calls rather than expressions.
2182
> 
2182
> ##
2183
> ### ** Examples
2183
> text(1,10,  "Derivatives:", adj=0)
2184
> 
2184
> text(1,9.6, expression(
2185
> require(graphics)
2185
+  "             first: {f * minute}(x) " == {f * minute}(x)), adj=0)
2186
> 
2186
> text(1,9.0, expression(
2187
> x <- seq(-4, 4, len = 101)
2187
+  "     second: {f * second}(x) "        == {f * second}(x)), adj=0)
2188
> y <- cbind(sin(x), cos(x))
2188
> 
2189
> matplot(x, y, type = "l", xaxt = "n",
2189
> 
2190
+         main = expression(paste(plain(sin) * phi, "  and  ",
2190
> plot(1:10, 1:10)
2191
+                                 plain(cos) * phi)),
2191
> text(4, 9, expression(hat(beta) == (X^t * X)^{-1} * X^t * y))
2192
+         ylab = expression("sin" * phi, "cos" * phi), # only 1st is taken
2192
> text(4, 8.4, "expression(hat(beta) == (X^t * X)^{-1} * X^t * y)",
2193
+         xlab = expression(paste("Phase Angle ", phi)),
2193
+      cex = .8)
2194
+         col.main = "blue")
2194
> text(4, 7, expression(bar(x) == sum(frac(x[i], n), i==1, n)))
2195
> axis(1, at = c(-pi, -pi/2, 0, pi/2, pi),
2195
> text(4, 6.4, "expression(bar(x) == sum(frac(x[i], n), i==1, n))",
2196
+      labels = expression(-pi, -pi/2, 0, pi/2, pi))
2196
+      cex = .8)
2197
> 
2197
> text(8, 5, expression(paste(frac(1, sigma*sqrt(2*pi)), " ",
2198
> 
2198
+                             plain(e)^{frac(-(x-mu)^2, 2*sigma^2)})),
2199
> ## How to combine "math" and numeric variables :
2199
+      cex = 1.2)
2200
> plot(1:10, type="n", xlab="", ylab="", main = "plot math & numbers")
2200
> 
2201
> theta <- 1.23 ; mtext(bquote(hat(theta) == .(theta)), line= .25)
2201
> ## some other useful symbols
2202
> for(i in 2:9)
2202
> plot.new(); plot.window(c(0,4), c(15,1))
2203
+     text(i,i+1, substitute(list(xi,eta) == group("(",list(x,y),")"),
2203
> text(1, 1, "universal", adj=0); text(2.5, 1,  "\\042")
2204
+                            list(x=i, y=i+1)))
2204
> text(3, 1, expression(symbol("\042")))
2205
> ## note that both of these use calls rather than expressions.
2205
> text(1, 2, "existential", adj=0); text(2.5, 2,  "\\044")
2206
> ##
2206
> text(3, 2, expression(symbol("\044")))
2207
> text(1,10,  "Derivatives:", adj=0)
2207
> text(1, 3, "suchthat", adj=0); text(2.5, 3,  "\\047")
2208
> text(1,9.6, expression(
2208
> text(3, 3, expression(symbol("\047")))
2209
+  "             first: {f * minute}(x) " == {f * minute}(x)), adj=0)
2209
> text(1, 4, "therefore", adj=0); text(2.5, 4,  "\\134")
2210
> text(1,9.0, expression(
2210
> text(3, 4, expression(symbol("\134")))
2211
+  "     second: {f * second}(x) "        == {f * second}(x)), adj=0)
2211
> text(1, 5, "perpendicular", adj=0); text(2.5, 5,  "\\136")
2212
> 
2212
> text(3, 5, expression(symbol("\136")))
2213
> 
2213
> text(1, 6, "circlemultiply", adj=0); text(2.5, 6,  "\\304")
2214
> plot(1:10, 1:10)
2214
> text(3, 6, expression(symbol("\304")))
2215
> text(4, 9, expression(hat(beta) == (X^t * X)^{-1} * X^t * y))
2215
> text(1, 7, "circleplus", adj=0); text(2.5, 7,  "\\305")
2216
> text(4, 8.4, "expression(hat(beta) == (X^t * X)^{-1} * X^t * y)",
2216
> text(3, 7, expression(symbol("\305")))
2217
+      cex = .8)
2217
> text(1, 8, "emptyset", adj=0); text(2.5, 8,  "\\306")
2218
> text(4, 7, expression(bar(x) == sum(frac(x[i], n), i==1, n)))
2218
> text(3, 8, expression(symbol("\306")))
2219
> text(4, 6.4, "expression(bar(x) == sum(frac(x[i], n), i==1, n))",
2219
> text(1, 9, "angle", adj=0); text(2.5, 9,  "\\320")
2220
+      cex = .8)
2220
> text(3, 9, expression(symbol("\320")))
2221
> text(8, 5, expression(paste(frac(1, sigma*sqrt(2*pi)), " ",
2221
> text(1, 10, "leftangle", adj=0); text(2.5, 10,  "\\341")
2222
+                             plain(e)^{frac(-(x-mu)^2, 2*sigma^2)})),
2222
> text(3, 10, expression(symbol("\341")))
2223
+      cex = 1.2)
2223
> text(1, 11, "rightangle", adj=0); text(2.5, 11,  "\\361")
2224
> 
2224
> text(3, 11, expression(symbol("\361")))
2225
> ## some other useful symbols
2225
> 
2226
> plot.new(); plot.window(c(0,4), c(15,1))
2226
> 
2227
> text(1, 1, "universal", adj=0); text(2.5, 1,  "\\042")
2227
> 
2228
> text(3, 1, expression(symbol("\042")))
2228
> cleanEx()
2229
> text(1, 2, "existential", adj=0); text(2.5, 2,  "\\044")
2229
> nameEx("postscriptFonts")
2230
> text(3, 2, expression(symbol("\044")))
2230
> ### * postscriptFonts
2231
> text(1, 3, "suchthat", adj=0); text(2.5, 3,  "\\047")
2231
> 
2232
> text(3, 3, expression(symbol("\047")))
2232
> flush(stderr()); flush(stdout())
2233
> text(1, 4, "therefore", adj=0); text(2.5, 4,  "\\134")
2233
> 
2234
> text(3, 4, expression(symbol("\134")))
2234
> ### Name: postscriptFonts
2235
> text(1, 5, "perpendicular", adj=0); text(2.5, 5,  "\\136")
2235
> ### Title: PostScript and PDF Font Families
2236
> text(3, 5, expression(symbol("\136")))
2236
> ### Aliases: postscriptFonts pdfFonts
2237
> text(1, 6, "circlemultiply", adj=0); text(2.5, 6,  "\\304")
2237
> ### Keywords: device
2238
> text(3, 6, expression(symbol("\304")))
2238
> 
2239
> text(1, 7, "circleplus", adj=0); text(2.5, 7,  "\\305")
2239
> ### ** Examples
2240
> text(3, 7, expression(symbol("\305")))
2240
> 
2241
> text(1, 8, "emptyset", adj=0); text(2.5, 8,  "\\306")
2241
> postscriptFonts()
2242
> text(3, 8, expression(symbol("\306")))
2242
$serif
2243
> text(1, 9, "angle", adj=0); text(2.5, 9,  "\\320")
2243
$family
2244
> text(3, 9, expression(symbol("\320")))
2244
[1] "Times"
2245
> text(1, 10, "leftangle", adj=0); text(2.5, 10,  "\\341")
2245
 
2246
> text(3, 10, expression(symbol("\341")))
2246
$metrics
2247
> text(1, 11, "rightangle", adj=0); text(2.5, 11,  "\\361")
2247
[1] "Times-Roman.afm"      "Times-Bold.afm"       "Times-Italic.afm"    
2248
> text(3, 11, expression(symbol("\361")))
2248
[4] "Times-BoldItalic.afm" "Symbol.afm"          
2249
> 
2249
 
2250
> 
2250
$encoding
2251
> 
2251
[1] "default"
2252
> cleanEx()
2252
 
2253
> nameEx("postscriptFonts")
2253
attr(,"class")
2254
> ### * postscriptFonts
2254
[1] "Type1Font"
2255
> 
2255
 
2256
> flush(stderr()); flush(stdout())
2256
$sans
2257
> 
2257
$family
2258
> ### Name: postscriptFonts
2258
[1] "Helvetica"
2259
> ### Title: PostScript and PDF Font Families
2259
 
2260
> ### Aliases: postscriptFonts pdfFonts
2260
$metrics
2261
> ### Keywords: device
2261
[1] "Helvetica.afm"             "Helvetica-Bold.afm"       
2262
> 
2262
[3] "Helvetica-Oblique.afm"     "Helvetica-BoldOblique.afm"
2263
> ### ** Examples
2263
[5] "Symbol.afm"               
2264
> 
2264
 
2265
> postscriptFonts()
2265
$encoding
2266
$serif
2266
[1] "default"
2267
$family
2267
 
2268
[1] "Times"
2268
attr(,"class")
2269
 
2269
[1] "Type1Font"
2270
$metrics
2270
 
2271
[1] "Times-Roman.afm"      "Times-Bold.afm"       "Times-Italic.afm"    
2271
$mono
2272
[4] "Times-BoldItalic.afm" "Symbol.afm"          
2272
$family
2273
 
2273
[1] "Courier"
2274
$encoding
2274
 
2275
[1] "default"
2275
$metrics
2276
 
2276
[1] "Courier.afm"             "Courier-Bold.afm"       
2277
attr(,"class")
2277
[3] "Courier-Oblique.afm"     "Courier-BoldOblique.afm"
2278
[1] "Type1Font"
2278
[5] "Symbol.afm"             
2279
 
2279
 
2280
$sans
2280
$encoding
2281
$family
2281
[1] "default"
2282
[1] "Helvetica"
2282
 
2283
 
2283
attr(,"class")
2284
$metrics
2284
[1] "Type1Font"
2285
[1] "Helvetica.afm"             "Helvetica-Bold.afm"       
2285
 
2286
[3] "Helvetica-Oblique.afm"     "Helvetica-BoldOblique.afm"
2286
$AvantGarde
2287
[5] "Symbol.afm"               
2287
$family
2288
 
2288
[1] "AvantGarde"
2289
$encoding
2289
 
2290
[1] "default"
2290
$metrics
2291
 
2291
[1] "agw_____.afm" "agd_____.afm" "agwo____.afm" "agdo____.afm" "Symbol.afm"  
2292
attr(,"class")
2292
 
2293
[1] "Type1Font"
2293
$encoding
2294
 
2294
[1] "default"
2295
$mono
2295
 
2296
$family
2296
attr(,"class")
2297
[1] "Courier"
2297
[1] "Type1Font"
2298
 
2298
 
2299
$metrics
2299
$Bookman
2300
[1] "Courier.afm"             "Courier-Bold.afm"       
2300
$family
2301
[3] "Courier-Oblique.afm"     "Courier-BoldOblique.afm"
2301
[1] "Bookman"
2302
[5] "Symbol.afm"             
2302
 
2303
 
2303
$metrics
2304
$encoding
2304
[1] "bkl_____.afm" "bkd_____.afm" "bkli____.afm" "bkdi____.afm" "Symbol.afm"  
2305
[1] "default"
2305
 
2306
 
2306
$encoding
2307
attr(,"class")
2307
[1] "default"
2308
[1] "Type1Font"
2308
 
2309
 
2309
attr(,"class")
2310
$AvantGarde
2310
[1] "Type1Font"
2311
$family
2311
 
2312
[1] "AvantGarde"
2312
$Courier
2313
 
2313
$family
2314
$metrics
2314
[1] "Courier"
2315
[1] "agw_____.afm" "agd_____.afm" "agwo____.afm" "agdo____.afm" "Symbol.afm"  
2315
 
2316
 
2316
$metrics
2317
$encoding
2317
[1] "Courier.afm"             "Courier-Bold.afm"       
2318
[1] "default"
2318
[3] "Courier-Oblique.afm"     "Courier-BoldOblique.afm"
2319
 
2319
[5] "Symbol.afm"             
2320
attr(,"class")
2320
 
2321
[1] "Type1Font"
2321
$encoding
2322
 
2322
[1] "default"
2323
$Bookman
2323
 
2324
$family
2324
attr(,"class")
2325
[1] "Bookman"
2325
[1] "Type1Font"
2326
 
2326
 
2327
$metrics
2327
$Helvetica
2328
[1] "bkl_____.afm" "bkd_____.afm" "bkli____.afm" "bkdi____.afm" "Symbol.afm"  
2328
$family
2329
 
2329
[1] "Helvetica"
2330
$encoding
2330
 
2331
[1] "default"
2331
$metrics
2332
 
2332
[1] "Helvetica.afm"             "Helvetica-Bold.afm"       
2333
attr(,"class")
2333
[3] "Helvetica-Oblique.afm"     "Helvetica-BoldOblique.afm"
2334
[1] "Type1Font"
2334
[5] "Symbol.afm"               
2335
 
2335
 
2336
$Courier
2336
$encoding
2337
$family
2337
[1] "default"
2338
[1] "Courier"
2338
 
2339
 
2339
attr(,"class")
2340
$metrics
2340
[1] "Type1Font"
2341
[1] "Courier.afm"             "Courier-Bold.afm"       
2341
 
2342
[3] "Courier-Oblique.afm"     "Courier-BoldOblique.afm"
2342
$`Helvetica-Narrow`
2343
[5] "Symbol.afm"             
2343
$family
2344
 
2344
[1] "Helvetica-Narrow"
2345
$encoding
2345
 
2346
[1] "default"
2346
$metrics
2347
 
2347
[1] "hvn_____.afm" "hvnb____.afm" "hvno____.afm" "hvnbo___.afm" "Symbol.afm"  
2348
attr(,"class")
2348
 
2349
[1] "Type1Font"
2349
$encoding
2350
 
2350
[1] "default"
2351
$Helvetica
2351
 
2352
$family
2352
attr(,"class")
2353
[1] "Helvetica"
2353
[1] "Type1Font"
2354
 
2354
 
2355
$metrics
2355
$NewCenturySchoolbook
2356
[1] "Helvetica.afm"             "Helvetica-Bold.afm"       
2356
$family
2357
[3] "Helvetica-Oblique.afm"     "Helvetica-BoldOblique.afm"
2357
[1] "NewCenturySchoolbook"
2358
[5] "Symbol.afm"               
2358
 
2359
 
2359
$metrics
2360
$encoding
2360
[1] "ncr_____.afm" "ncb_____.afm" "nci_____.afm" "ncbi____.afm" "Symbol.afm"  
2361
[1] "default"
2361
 
2362
 
2362
$encoding
2363
attr(,"class")
2363
[1] "default"
2364
[1] "Type1Font"
2364
 
2365
 
2365
attr(,"class")
2366
$`Helvetica-Narrow`
2366
[1] "Type1Font"
2367
$family
2367
 
2368
[1] "Helvetica-Narrow"
2368
$Palatino
2369
 
2369
$family
2370
$metrics
2370
[1] "Palatino"
2371
[1] "hvn_____.afm" "hvnb____.afm" "hvno____.afm" "hvnbo___.afm" "Symbol.afm"  
2371
 
2372
 
2372
$metrics
2373
$encoding
2373
[1] "por_____.afm" "pob_____.afm" "poi_____.afm" "pobi____.afm" "Symbol.afm"  
2374
[1] "default"
2374
 
2375
 
2375
$encoding
2376
attr(,"class")
2376
[1] "default"
2377
[1] "Type1Font"
2377
 
2378
 
2378
attr(,"class")
2379
$NewCenturySchoolbook
2379
[1] "Type1Font"
2380
$family
2380
 
2381
[1] "NewCenturySchoolbook"
2381
$Times
2382
 
2382
$family
2383
$metrics
2383
[1] "Times"
2384
[1] "ncr_____.afm" "ncb_____.afm" "nci_____.afm" "ncbi____.afm" "Symbol.afm"  
2384
 
2385
 
2385
$metrics
2386
$encoding
2386
[1] "Times-Roman.afm"      "Times-Bold.afm"       "Times-Italic.afm"    
2387
[1] "default"
2387
[4] "Times-BoldItalic.afm" "Symbol.afm"          
2388
 
2388
 
2389
attr(,"class")
2389
$encoding
2390
[1] "Type1Font"
2390
[1] "default"
2391
 
2391
 
2392
$Palatino
2392
attr(,"class")
2393
$family
2393
[1] "Type1Font"
2394
[1] "Palatino"
2394
 
2395
 
2395
$URWGothic
2396
$metrics
2396
$family
2397
[1] "por_____.afm" "pob_____.afm" "poi_____.afm" "pobi____.afm" "Symbol.afm"  
2397
[1] "URWGothic"
2398
 
2398
 
2399
$encoding
2399
$metrics
2400
[1] "default"
2400
[1] "a010013l.afm" "a010015l.afm" "a010033l.afm" "a010035l.afm" "s050000l.afm"
2401
 
2401
 
2402
attr(,"class")
2402
$encoding
2403
[1] "Type1Font"
2403
[1] "default"
2404
 
2404
 
2405
$Times
2405
attr(,"class")
2406
$family
2406
[1] "Type1Font"
2407
[1] "Times"
2407
 
2408
 
2408
$URWBookman
2409
$metrics
2409
$family
2410
[1] "Times-Roman.afm"      "Times-Bold.afm"       "Times-Italic.afm"    
2410
[1] "URWBookman"
2411
[4] "Times-BoldItalic.afm" "Symbol.afm"          
2411
 
2412
 
2412
$metrics
2413
$encoding
2413
[1] "b018012l.afm" "b018015l.afm" "b018032l.afm" "b018035l.afm" "s050000l.afm"
2414
[1] "default"
2414
 
2415
 
2415
$encoding
2416
attr(,"class")
2416
[1] "default"
2417
[1] "Type1Font"
2417
 
2418
 
2418
attr(,"class")
2419
$URWGothic
2419
[1] "Type1Font"
2420
$family
2420
 
2421
[1] "URWGothic"
2421
$NimbusMon
2422
 
2422
$family
2423
$metrics
2423
[1] "NimbusMon"
2424
[1] "a010013l.afm" "a010015l.afm" "a010033l.afm" "a010035l.afm" "s050000l.afm"
2424
 
2425
 
2425
$metrics
2426
$encoding
2426
[1] "n022003l.afm" "n022004l.afm" "n022023l.afm" "n022024l.afm" "s050000l.afm"
2427
[1] "default"
2427
 
2428
 
2428
$encoding
2429
attr(,"class")
2429
[1] "default"
2430
[1] "Type1Font"
2430
 
2431
 
2431
attr(,"class")
2432
$URWBookman
2432
[1] "Type1Font"
2433
$family
2433
 
2434
[1] "URWBookman"
2434
$NimbusSan
2435
 
2435
$family
2436
$metrics
2436
[1] "NimbusSan"
2437
[1] "b018012l.afm" "b018015l.afm" "b018032l.afm" "b018035l.afm" "s050000l.afm"
2437
 
2438
 
2438
$metrics
2439
$encoding
2439
[1] "n019003l.afm" "n019004l.afm" "n019023l.afm" "n019024l.afm" "s050000l.afm"
2440
[1] "default"
2440
 
2441
 
2441
$encoding
2442
attr(,"class")
2442
[1] "default"
2443
[1] "Type1Font"
2443
 
2444
 
2444
attr(,"class")
2445
$NimbusMon
2445
[1] "Type1Font"
2446
$family
2446
 
2447
[1] "NimbusMon"
2447
$URWHelvetica
2448
 
2448
$family
2449
$metrics
2449
[1] "URWHelvetica"
2450
[1] "n022003l.afm" "n022004l.afm" "n022023l.afm" "n022024l.afm" "s050000l.afm"
2450
 
2451
 
2451
$metrics
2452
$encoding
2452
[1] "n019003l.afm" "n019004l.afm" "n019023l.afm" "n019024l.afm" "s050000l.afm"
2453
[1] "default"
2453
 
2454
 
2454
$encoding
2455
attr(,"class")
2455
[1] "default"
2456
[1] "Type1Font"
2456
 
2457
 
2457
attr(,"class")
2458
$NimbusSan
2458
[1] "Type1Font"
2459
$family
2459
 
2460
[1] "NimbusSan"
2460
$NimbusSanCond
2461
 
2461
$family
2462
$metrics
2462
[1] "NimbusSanCond"
2463
[1] "n019003l.afm" "n019004l.afm" "n019023l.afm" "n019024l.afm" "s050000l.afm"
2463
 
2464
 
2464
$metrics
2465
$encoding
2465
[1] "n019043l.afm" "n019044l.afm" "n019063l.afm" "n019064l.afm" "s050000l.afm"
2466
[1] "default"
2466
 
2467
 
2467
$encoding
2468
attr(,"class")
2468
[1] "default"
2469
[1] "Type1Font"
2469
 
2470
 
2470
attr(,"class")
2471
$URWHelvetica
2471
[1] "Type1Font"
2472
$family
2472
 
2473
[1] "URWHelvetica"
2473
$CenturySch
2474
 
2474
$family
2475
$metrics
2475
[1] "CenturySch"
2476
[1] "n019003l.afm" "n019004l.afm" "n019023l.afm" "n019024l.afm" "s050000l.afm"
2476
 
2477
 
2477
$metrics
2478
$encoding
2478
[1] "c059013l.afm" "c059016l.afm" "c059033l.afm" "c059036l.afm" "s050000l.afm"
2479
[1] "default"
2479
 
2480
 
2480
$encoding
2481
attr(,"class")
2481
[1] "default"
2482
[1] "Type1Font"
2482
 
2483
 
2483
attr(,"class")
2484
$NimbusSanCond
2484
[1] "Type1Font"
2485
$family
2485
 
2486
[1] "NimbusSanCond"
2486
$URWPalladio
2487
 
2487
$family
2488
$metrics
2488
[1] "URWPalladio"
2489
[1] "n019043l.afm" "n019044l.afm" "n019063l.afm" "n019064l.afm" "s050000l.afm"
2489
 
2490
 
2490
$metrics
2491
$encoding
2491
[1] "p052003l.afm" "p052004l.afm" "p052023l.afm" "p052024l.afm" "s050000l.afm"
2492
[1] "default"
2492
 
2493
 
2493
$encoding
2494
attr(,"class")
2494
[1] "default"
2495
[1] "Type1Font"
2495
 
2496
 
2496
attr(,"class")
2497
$CenturySch
2497
[1] "Type1Font"
2498
$family
2498
 
2499
[1] "CenturySch"
2499
$NimbusRom
2500
 
2500
$family
2501
$metrics
2501
[1] "NimbusRom"
2502
[1] "c059013l.afm" "c059016l.afm" "c059033l.afm" "c059036l.afm" "s050000l.afm"
2502
 
2503
 
2503
$metrics
2504
$encoding
2504
[1] "n021003l.afm" "n021004l.afm" "n021023l.afm" "n021024l.afm" "s050000l.afm"
2505
[1] "default"
2505
 
2506
 
2506
$encoding
2507
attr(,"class")
2507
[1] "default"
2508
[1] "Type1Font"
2508
 
2509
 
2509
attr(,"class")
2510
$URWPalladio
2510
[1] "Type1Font"
2511
$family
2511
 
2512
[1] "URWPalladio"
2512
$URWTimes
2513
 
2513
$family
2514
$metrics
2514
[1] "URWTimes"
2515
[1] "p052003l.afm" "p052004l.afm" "p052023l.afm" "p052024l.afm" "s050000l.afm"
2515
 
2516
 
2516
$metrics
2517
$encoding
2517
[1] "n021003l.afm" "n021004l.afm" "n021023l.afm" "n021024l.afm" "s050000l.afm"
2518
[1] "default"
2518
 
2519
 
2519
$encoding
2520
attr(,"class")
2520
[1] "default"
2521
[1] "Type1Font"
2521
 
2522
 
2522
attr(,"class")
2523
$NimbusRom
2523
[1] "Type1Font"
2524
$family
2524
 
2525
[1] "NimbusRom"
2525
$ComputerModern
2526
 
2526
$family
2527
$metrics
2527
[1] "ComputerModern"
2528
[1] "n021003l.afm" "n021004l.afm" "n021023l.afm" "n021024l.afm" "s050000l.afm"
2528
 
2529
 
2529
$metrics
2530
$encoding
2530
[1] "CM_regular_10.afm"      "CM_boldx_10.afm"        "CM_italic_10.afm"      
2531
[1] "default"
2531
[4] "CM_boldx_italic_10.afm" "CM_symbol_10.afm"      
2532
 
2532
 
2533
attr(,"class")
2533
$encoding
2534
[1] "Type1Font"
2534
[1] "TeXtext.enc"
2535
 
2535
 
2536
$URWTimes
2536
attr(,"class")
2537
$family
2537
[1] "Type1Font"
2538
[1] "URWTimes"
2538
 
2539
 
2539
$ComputerModernItalic
2540
$metrics
2540
$family
2541
[1] "n021003l.afm" "n021004l.afm" "n021023l.afm" "n021024l.afm" "s050000l.afm"
2541
[1] "ComputerModernItalic"
2542
 
2542
 
2543
$encoding
2543
$metrics
2544
[1] "default"
2544
[1] "CM_regular_10.afm" "CM_boldx_10.afm"   "cmti10.afm"       
2545
 
2545
[4] "cmbxti10.afm"      "CM_symbol_10.afm" 
2546
attr(,"class")
2546
 
2547
[1] "Type1Font"
2547
$encoding
2548
 
2548
[1] "TeXtext.enc"
2549
$ComputerModern
2549
 
2550
$family
2550
attr(,"class")
2551
[1] "ComputerModern"
2551
[1] "Type1Font"
2552
 
2552
 
2553
$metrics
2553
$Japan1
2554
[1] "CM_regular_10.afm"      "CM_boldx_10.afm"        "CM_italic_10.afm"      
2554
$family
2555
[4] "CM_boldx_italic_10.afm" "CM_symbol_10.afm"      
2555
[1] "HeiseiKakuGo-W5"
2556
 
2556
 
2557
$encoding
2557
$metrics
2558
[1] "TeXtext.enc"
2558
[1] ""           ""           ""           ""           "Symbol.afm"
2559
 
2559
 
2560
attr(,"class")
2560
$cmap
2561
[1] "Type1Font"
2561
[1] "EUC-H"
2562
 
2562
 
2563
$ComputerModernItalic
2563
$cmapEncoding
2564
$family
2564
[1] "EUC-JP"
2565
[1] "ComputerModernItalic"
2565
 
2566
 
2566
$pdfresource
2567
$metrics
2567
[1] ""
2568
[1] "CM_regular_10.afm" "CM_boldx_10.afm"   "cmti10.afm"       
2568
 
2569
[4] "cmbxti10.afm"      "CM_symbol_10.afm" 
2569
attr(,"class")
2570
 
2570
[1] "CIDFont"
2571
$encoding
2571
 
2572
[1] "TeXtext.enc"
2572
$Japan1HeiMin
2573
 
2573
$family
2574
attr(,"class")
2574
[1] "HeiseiMin-W3"
2575
[1] "Type1Font"
2575
 
2576
 
2576
$metrics
2577
$Japan1
2577
[1] ""           ""           ""           ""           "Symbol.afm"
2578
$family
2578
 
2579
[1] "HeiseiKakuGo-W5"
2579
$cmap
2580
 
2580
[1] "EUC-H"
2581
$metrics
2581
 
2582
[1] ""           ""           ""           ""           "Symbol.afm"
2582
$cmapEncoding
2583
 
2583
[1] "EUC-JP"
2584
$cmap
2584
 
2585
[1] "EUC-H"
2585
$pdfresource
2586
 
2586
[1] ""
2587
$cmapEncoding
2587
 
2588
[1] "EUC-JP"
2588
attr(,"class")
2589
 
2589
[1] "CIDFont"
2590
$pdfresource
2590
 
2591
[1] ""
2591
$Japan1GothicBBB
2592
 
2592
$family
2593
attr(,"class")
2593
[1] "GothicBBB-Medium"
2594
[1] "CIDFont"
2594
 
2595
 
2595
$metrics
2596
$Japan1HeiMin
2596
[1] ""           ""           ""           ""           "Symbol.afm"
2597
$family
2597
 
2598
[1] "HeiseiMin-W3"
2598
$cmap
2599
 
2599
[1] "EUC-H"
2600
$metrics
2600
 
2601
[1] ""           ""           ""           ""           "Symbol.afm"
2601
$cmapEncoding
2602
 
2602
[1] "EUC-JP"
2603
$cmap
2603
 
2604
[1] "EUC-H"
2604
$pdfresource
2605
 
2605
[1] ""
2606
$cmapEncoding
2606
 
2607
[1] "EUC-JP"
2607
attr(,"class")
2608
 
2608
[1] "CIDFont"
2609
$pdfresource
2609
 
2610
[1] ""
2610
$Japan1Ryumin
2611
 
2611
$family
2612
attr(,"class")
2612
[1] "Ryumin-Light"
2613
[1] "CIDFont"
2613
 
2614
 
2614
$metrics
2615
$Japan1GothicBBB
2615
[1] ""           ""           ""           ""           "Symbol.afm"
2616
$family
2616
 
2617
[1] "GothicBBB-Medium"
2617
$cmap
2618
 
2618
[1] "EUC-H"
2619
$metrics
2619
 
2620
[1] ""           ""           ""           ""           "Symbol.afm"
2620
$cmapEncoding
2621
 
2621
[1] "EUC-JP"
2622
$cmap
2622
 
2623
[1] "EUC-H"
2623
$pdfresource
2624
 
2624
[1] ""
2625
$cmapEncoding
2625
 
2626
[1] "EUC-JP"
2626
attr(,"class")
2627
 
2627
[1] "CIDFont"
2628
$pdfresource
2628
 
2629
[1] ""
2629
$Korea1
2630
 
2630
$family
2631
attr(,"class")
2631
[1] "Baekmuk-Batang"
2632
[1] "CIDFont"
2632
 
2633
 
2633
$metrics
2634
$Japan1Ryumin
2634
[1] ""           ""           ""           ""           "Symbol.afm"
2635
$family
2635
 
2636
[1] "Ryumin-Light"
2636
$cmap
2637
 
2637
[1] "KSCms-UHC-H"
2638
$metrics
2638
 
2639
[1] ""           ""           ""           ""           "Symbol.afm"
2639
$cmapEncoding
2640
 
2640
[1] "CP949"
2641
$cmap
2641
 
2642
[1] "EUC-H"
2642
$pdfresource
2643
 
2643
[1] ""
2644
$cmapEncoding
2644
 
2645
[1] "EUC-JP"
2645
attr(,"class")
2646
 
2646
[1] "CIDFont"
2647
$pdfresource
2647
 
2648
[1] ""
2648
$Korea1deb
2649
 
2649
$family
2650
attr(,"class")
2650
[1] "Batang-Regular"
2651
[1] "CIDFont"
2651
 
2652
 
2652
$metrics
2653
$Korea1
2653
[1] ""           ""           ""           ""           "Symbol.afm"
2654
$family
2654
 
2655
[1] "Baekmuk-Batang"
2655
$cmap
2656
 
2656
[1] "KSCms-UHC-H"
2657
$metrics
2657
 
2658
[1] ""           ""           ""           ""           "Symbol.afm"
2658
$cmapEncoding
2659
 
2659
[1] "CP949"
2660
$cmap
2660
 
2661
[1] "KSCms-UHC-H"
2661
$pdfresource
2662
 
2662
[1] ""
2663
$cmapEncoding
2663
 
2664
[1] "CP949"
2664
attr(,"class")
2665
 
2665
[1] "CIDFont"
2666
$pdfresource
2666
 
2667
[1] ""
2667
$CNS1
2668
 
2668
$family
2669
attr(,"class")
2669
[1] "MOESung-Regular"
2670
[1] "CIDFont"
2670
 
2671
 
2671
$metrics
2672
$Korea1deb
2672
[1] ""           ""           ""           ""           "Symbol.afm"
2673
$family
2673
 
2674
[1] "Batang-Regular"
2674
$cmap
2675
 
2675
[1] "B5pc-H"
2676
$metrics
2676
 
2677
[1] ""           ""           ""           ""           "Symbol.afm"
2677
$cmapEncoding
2678
 
2678
[1] "CP950"
2679
$cmap
2679
 
2680
[1] "KSCms-UHC-H"
2680
$pdfresource
2681
 
2681
[1] ""
2682
$cmapEncoding
2682
 
2683
[1] "CP949"
2683
attr(,"class")
2684
 
2684
[1] "CIDFont"
2685
$pdfresource
2685
 
2686
[1] ""
2686
$GB1
2687
 
2687
$family
2688
attr(,"class")
2688
[1] "BousungEG-Light-GB"
2689
[1] "CIDFont"
2689
 
2690
 
2690
$metrics
2691
$CNS1
2691
[1] ""           ""           ""           ""           "Symbol.afm"
2692
$family
2692
 
2693
[1] "MOESung-Regular"
2693
$cmap
2694
 
2694
[1] "GBK-EUC-H"
2695
$metrics
2695
 
2696
[1] ""           ""           ""           ""           "Symbol.afm"
2696
$cmapEncoding
2697
 
2697
[1] "GBK"
2698
$cmap
2698
 
2699
[1] "B5pc-H"
2699
$pdfresource
2700
 
2700
[1] ""
2701
$cmapEncoding
2701
 
2702
[1] "CP950"
2702
attr(,"class")
2703
 
2703
[1] "CIDFont"
2704
$pdfresource
2704
 
2705
[1] ""
2705
> ## This duplicates "ComputerModernItalic".
2706
 
2706
> CMitalic <- Type1Font("ComputerModern2",
2707
attr(,"class")
2707
+                       c("CM_regular_10.afm", "CM_boldx_10.afm",
2708
[1] "CIDFont"
2708
+                         "cmti10.afm", "cmbxti10.afm",
2709
 
2709
+                          "CM_symbol_10.afm"),
2710
$GB1
2710
+                       encoding = "TeXtext.enc")
2711
$family
2711
> postscriptFonts(CMitalic = CMitalic)
2712
[1] "BousungEG-Light-GB"
2712
> 
2713
 
2713
> ## A CID font for Japanese using a different CMap and
2714
$metrics
2714
> ## corresponding cmapEncoding.
2715
[1] ""           ""           ""           ""           "Symbol.afm"
2715
> `Jp_UCS-2` <- CIDFont("TestUCS2",
2716
 
2716
+                   c("Adobe-Japan1-UniJIS-UCS2-H.afm",
2717
$cmap
2717
+                     "Adobe-Japan1-UniJIS-UCS2-H.afm",
2718
[1] "GBK-EUC-H"
2718
+                     "Adobe-Japan1-UniJIS-UCS2-H.afm",
2719
 
2719
+                     "Adobe-Japan1-UniJIS-UCS2-H.afm"),
2720
$cmapEncoding
2720
+                   "UniJIS-UCS2-H", "UCS-2")
2721
[1] "GBK"
2721
> pdfFonts(`Jp_UCS-2` = `Jp_UCS-2`)
2722
 
2722
> names(pdfFonts())
2723
$pdfresource
2723
 [1] "serif"                "sans"                 "mono"                
2724
[1] ""
2724
 [4] "AvantGarde"           "Bookman"              "Courier"             
2725
 
2725
 [7] "Helvetica"            "Helvetica-Narrow"     "NewCenturySchoolbook"
2726
attr(,"class")
2726
[10] "Palatino"             "Times"                "URWGothic"           
2727
[1] "CIDFont"
2727
[13] "URWBookman"           "NimbusMon"            "NimbusSan"           
2728
 
2728
[16] "URWHelvetica"         "NimbusSanCond"        "CenturySch"          
2729
> ## This duplicates "ComputerModernItalic".
2729
[19] "URWPalladio"          "NimbusRom"            "URWTimes"            
2730
> CMitalic <- Type1Font("ComputerModern2",
2730
[22] "Japan1"               "Japan1HeiMin"         "Japan1GothicBBB"     
2731
+                       c("CM_regular_10.afm", "CM_boldx_10.afm",
2731
[25] "Japan1Ryumin"         "Korea1"               "Korea1deb"           
2732
+                         "cmti10.afm", "cmbxti10.afm",
2732
[28] "CNS1"                 "GB1"                  "Jp_UCS-2"            
2733
+                          "CM_symbol_10.afm"),
2733
> 
2734
+                       encoding = "TeXtext.enc")
2734
> 
2735
> postscriptFonts(CMitalic = CMitalic)
2735
> 
2736
> 
2736
> cleanEx()
2737
> ## A CID font for Japanese using a different CMap and
2737
> nameEx("pretty.Date")
2738
> ## corresponding cmapEncoding.
2738
> ### * pretty.Date
2739
> `Jp_UCS-2` <- CIDFont("TestUCS2",
2739
> 
2740
+                   c("Adobe-Japan1-UniJIS-UCS2-H.afm",
2740
> flush(stderr()); flush(stdout())
2741
+                     "Adobe-Japan1-UniJIS-UCS2-H.afm",
2741
> 
2742
+                     "Adobe-Japan1-UniJIS-UCS2-H.afm",
2742
> ### Name: pretty.Date
2743
+                     "Adobe-Japan1-UniJIS-UCS2-H.afm"),
2743
> ### Title: Pretty Breakpoints for Date-Time Classes
2744
+                   "UniJIS-UCS2-H", "UCS-2")
2744
> ### Aliases: pretty.Date pretty.POSIXt
2745
> pdfFonts(`Jp_UCS-2` = `Jp_UCS-2`)
2745
> ### Keywords: dplot
2746
> names(pdfFonts())
2746
> 
2747
 [1] "serif"                "sans"                 "mono"                
2747
> ### ** Examples
2748
 [4] "AvantGarde"           "Bookman"              "Courier"             
2748
> 
2749
 [7] "Helvetica"            "Helvetica-Narrow"     "NewCenturySchoolbook"
2749
> 
2750
[10] "Palatino"             "Times"                "URWGothic"           
2750
> steps <-
2751
[13] "URWBookman"           "NimbusMon"            "NimbusSan"           
2751
+     list("10 secs", "1 min", "5 mins", "30 mins", "6 hours", "12 hours",
2752
[16] "URWHelvetica"         "NimbusSanCond"        "CenturySch"          
2752
+          "1 DSTday", "2 weeks", "1 month", "6 months", "1 year",
2753
[19] "URWPalladio"          "NimbusRom"            "URWTimes"            
2753
+          "10 years", "50 years", "1000 years")
2754
[22] "Japan1"               "Japan1HeiMin"         "Japan1GothicBBB"     
2754
> 
2755
[25] "Japan1Ryumin"         "Korea1"               "Korea1deb"           
2755
> names(steps) <- paste("span =", unlist(steps))
2756
[28] "CNS1"                 "GB1"                  "Jp_UCS-2"            
2756
> 
2757
> 
2757
> x <- as.POSIXct("2002-02-02 02:02")
2758
> 
2758
> lapply(steps,
2759
> 
2759
+        function(s) {
2760
> cleanEx()
2760
+            at <- pretty(seq(x, by = s, length = 2), n = 5)
2761
> nameEx("pretty.Date")
2761
+            attr(at, "labels")
2762
> ### * pretty.Date
2762
+        })
2763
> 
2763
$`span = 10 secs`
2764
> flush(stderr()); flush(stdout())
2764
[1] "00" "02" "04" "06" "08" "10"
2765
> 
2765
 
2766
> ### Name: pretty.Date
2766
$`span = 1 min`
2767
> ### Title: Pretty Breakpoints for Date-Time Classes
2767
[1] "00" "10" "20" "30" "40" "50" "00"
2768
> ### Aliases: pretty.Date pretty.POSIXt
2768
 
2769
> ### Keywords: dplot
2769
$`span = 5 mins`
2770
> 
2770
[1] "02:02" "02:03" "02:04" "02:05" "02:06" "02:07"
2771
> ### ** Examples
2771
 
2772
> 
2772
$`span = 30 mins`
2773
> 
2773
[1] "02:05" "02:10" "02:15" "02:20" "02:25" "02:30"
2774
> steps <-
2774
 
2775
+     list("10 secs", "1 min", "5 mins", "30 mins", "6 hours", "12 hours",
2775
$`span = 6 hours`
2776
+          "1 DSTday", "2 weeks", "1 month", "6 months", "1 year",
2776
[1] "03:00" "04:00" "05:00" "06:00" "07:00" "08:00"
2777
+          "10 years", "50 years", "1000 years")
2777
 
2778
> 
2778
$`span = 12 hours`
2779
> names(steps) <- paste("span =", unlist(steps))
2779
[1] "03:00" "06:00" "09:00" "12:00"
2780
> 
2780
 
2781
> x <- as.POSIXct("2002-02-02 02:02")
2781
$`span = 1 DSTday`
2782
> lapply(steps,
2782
[1] "Feb 02 06:00" "Feb 02 12:00" "Feb 02 18:00" "Feb 03 00:00"
2783
+        function(s) {
2783
 
2784
+            at <- pretty(seq(x, by = s, length = 2), n = 5)
2784
$`span = 2 weeks`
2785
+            attr(at, "labels")
2785
[1] "Feb 04" "Feb 06" "Feb 08" "Feb 10" "Feb 12" "Feb 14" "Feb 16"
2786
+        })
2786
 
2787
$`span = 10 secs`
2787
$`span = 1 month`
2788
[1] "00" "02" "04" "06" "08" "10"
2788
[1] "Feb 04" "Feb 11" "Feb 18" "Feb 25"
2789
 
2789
 
2790
$`span = 1 min`
2790
$`span = 6 months`
2791
[1] "00" "10" "20" "30" "40" "50" "00"
2791
[1] "Mar" "Apr" "May" "Jun" "Jul" "Aug"
2792
 
2792
 
2793
$`span = 5 mins`
2793
$`span = 1 year`
2794
[1] "02:02" "02:03" "02:04" "02:05" "02:06" "02:07"
2794
[1] "Apr" "Jul" "Oct" "Jan"
2795
 
2795
 
2796
$`span = 30 mins`
2796
$`span = 10 years`
2797
[1] "02:05" "02:10" "02:15" "02:20" "02:25" "02:30"
2797
[1] "2004" "2006" "2008" "2010" "2012"
2798
 
2798
 
2799
$`span = 6 hours`
2799
$`span = 50 years`
2800
[1] "03:00" "04:00" "05:00" "06:00" "07:00" "08:00"
2800
[1] "2010" "2020" "2030" "2040" "2050"
2801
 
2801
 
2802
$`span = 12 hours`
2802
$`span = 1000 years`
2803
[1] "03:00" "06:00" "09:00" "12:00"
2803
[1] "2200" "2400" "2600" "2800" "3000"
2804
 
2804
 
2805
$`span = 1 DSTday`
2805
> 
2806
[1] "Feb 02 06:00" "Feb 02 12:00" "Feb 02 18:00" "Feb 03 00:00"
2806
> 
2807
 
2807
> 
2808
$`span = 2 weeks`
2808
> 
2809
[1] "Feb 04" "Feb 06" "Feb 08" "Feb 10" "Feb 12" "Feb 14" "Feb 16"
2809
> cleanEx()
2810
 
2810
> nameEx("ps.options")
2811
$`span = 1 month`
2811
> ### * ps.options
2812
[1] "Feb 04" "Feb 11" "Feb 18" "Feb 25"
2812
> 
2813
 
2813
> flush(stderr()); flush(stdout())
2814
$`span = 6 months`
2814
> 
2815
[1] "Mar" "Apr" "May" "Jun" "Jul" "Aug"
2815
> ### Name: ps.options
2816
 
2816
> ### Title: Auxiliary Function to Set/View Defaults for Arguments of
2817
$`span = 1 year`
2817
> ###   postscript
2818
[1] "Apr" "Jul" "Oct" "Jan"
2818
> ### Aliases: ps.options setEPS setPS
2819
 
2819
> ### Keywords: device
2820
$`span = 10 years`
2820
> 
2821
[1] "2004" "2006" "2008" "2010" "2012"
2821
> ### ** Examples
2822
 
2822
> 
2823
$`span = 50 years`
2823
> ps.options(bg = "pink")
2824
[1] "2010" "2020" "2030" "2040" "2050"
2824
> utils::str(ps.options())
2825
 
2825
List of 18
2826
$`span = 1000 years`
2826
 $ onefile    : logi TRUE
2827
[1] "2200" "2400" "2600" "2800" "3000"
2827
 $ family     : chr "Helvetica"
2828
 
2828
 $ title      : chr "R Graphics Output"
2829
> 
2829
 $ fonts      : NULL
2830
> 
2830
 $ encoding   : chr "default"
2831
> 
2831
 $ bg         : chr "pink"
2832
> 
2832
 $ fg         : chr "black"
2833
> cleanEx()
2833
 $ width      : num 7
2834
> nameEx("ps.options")
2834
 $ height     : num 7
2835
> ### * ps.options
2835
 $ horizontal : logi TRUE
2836
> 
2836
 $ pointsize  : num 12
2837
> flush(stderr()); flush(stdout())
2837
 $ paper      : chr "a4"
2838
> 
2838
 $ pagecentre : logi TRUE
2839
> ### Name: ps.options
2839
 $ print.it   : logi FALSE
2840
> ### Title: Auxiliary Function to Set/View Defaults for Arguments of
2840
 $ command    : chr "default"
2841
> ###   postscript
2841
 $ colormodel : chr "rgb"
2842
> ### Aliases: ps.options setEPS setPS
2842
 $ useKerning : logi TRUE
2843
> ### Keywords: device
2843
 $ fillOddEven: logi FALSE
2844
> 
2844
> 
2845
> ### ** Examples
2845
> ### ---- error checking of arguments: ----
2846
> 
2846
> ps.options(width=0:12, onefile=0, bg=pi)
2847
> ps.options(bg = "pink")
2847
Warning: 'mode(onefile)' and 'mode(bg)' differ between new and previous
2848
> utils::str(ps.options())
2848
	 ==> NOT changing 'onefile' & 'bg'
2849
List of 18
2849
Warning: 'length(width)' differs between new and previous
2850
 $ onefile    : logi TRUE
2850
	 ==> NOT changing 'width'
2851
 $ family     : chr "Helvetica"
2851
> # override the check for 'width', but not 'bg':
2852
 $ title      : chr "R Graphics Output"
2852
> ps.options(width=0:12, bg=pi, override.check = c(TRUE,FALSE))
2853
 $ fonts      : NULL
2853
Warning: 'mode(bg)' differs between new and previous
2854
 $ encoding   : chr "default"
2854
	 ==> NOT changing 'bg'
2855
 $ bg         : chr "pink"
2855
Warning: 'length(width)' differs between new and previous
2856
 $ fg         : chr "black"
2856
> utils::str(ps.options())
2857
 $ width      : num 7
2857
List of 18
2858
 $ height     : num 7
2858
 $ onefile    : logi TRUE
2859
 $ horizontal : logi TRUE
2859
 $ family     : chr "Helvetica"
2860
 $ pointsize  : num 12
2860
 $ title      : chr "R Graphics Output"
2861
 $ paper      : chr "a4"
2861
 $ fonts      : NULL
2862
 $ pagecentre : logi TRUE
2862
 $ encoding   : chr "default"
2863
 $ print.it   : logi FALSE
2863
 $ bg         : chr "pink"
2864
 $ command    : chr "default"
2864
 $ fg         : chr "black"
2865
 $ colormodel : chr "rgb"
2865
 $ width      : int [1:13] 0 1 2 3 4 5 6 7 8 9 ...
2866
 $ useKerning : logi TRUE
2866
 $ height     : num 7
2867
 $ fillOddEven: logi FALSE
2867
 $ horizontal : logi TRUE
2868
> 
2868
 $ pointsize  : num 12
2869
> ### ---- error checking of arguments: ----
2869
 $ paper      : chr "a4"
2870
> ps.options(width=0:12, onefile=0, bg=pi)
2870
 $ pagecentre : logi TRUE
2871
Warning: ‘mode(onefile)’ and ‘mode(bg)’ differ between new and previous
2871
 $ print.it   : logi FALSE
2872
	 ==> NOT changing ‘onefile’ & ‘bg’
2872
 $ command    : chr "default"
2873
Warning: ‘length(width)’ differs between new and previous
2873
 $ colormodel : chr "rgb"
2874
	 ==> NOT changing ‘width’
2874
 $ useKerning : logi TRUE
2875
> # override the check for 'width', but not 'bg':
2875
 $ fillOddEven: logi FALSE
2876
> ps.options(width=0:12, bg=pi, override.check = c(TRUE,FALSE))
2876
> ps.options(reset = TRUE) # back to factory-fresh
2877
Warning: ‘mode(bg)’ differs between new and previous
2877
> 
2878
	 ==> NOT changing ‘bg’
2878
> 
2879
Warning: ‘length(width)’ differs between new and previous
2879
> 
2880
> utils::str(ps.options())
2880
> cleanEx()
2881
List of 18
2881
> nameEx("recordGraphics")
2882
 $ onefile    : logi TRUE
2882
> ### * recordGraphics
2883
 $ family     : chr "Helvetica"
2883
> 
2884
 $ title      : chr "R Graphics Output"
2884
> flush(stderr()); flush(stdout())
2885
 $ fonts      : NULL
2885
> 
2886
 $ encoding   : chr "default"
2886
> ### Name: recordGraphics
2887
 $ bg         : chr "pink"
2887
> ### Title: Record Graphics Operations
2888
 $ fg         : chr "black"
2888
> ### Aliases: recordGraphics
2889
 $ width      : int [1:13] 0 1 2 3 4 5 6 7 8 9 ...
2889
> ### Keywords: device
2890
 $ height     : num 7
2890
> 
2891
 $ horizontal : logi TRUE
2891
> ### ** Examples
2892
 $ pointsize  : num 12
2892
> 
2893
 $ paper      : chr "a4"
2893
> require(graphics)
2894
 $ pagecentre : logi TRUE
2894
> 
2895
 $ print.it   : logi FALSE
2895
> plot(1:10)
2896
 $ command    : chr "default"
2896
> # This rectangle remains 1inch wide when the device is resized
2897
 $ colormodel : chr "rgb"
2897
> recordGraphics(
2898
 $ useKerning : logi TRUE
2898
+   {
2899
 $ fillOddEven: logi FALSE
2899
+     rect(4, 2,
2900
> ps.options(reset = TRUE) # back to factory-fresh
2900
+          4 + diff(par("usr")[1:2])/par("pin")[1], 3)
2901
> 
2901
+   },
2902
> 
2902
+   list(),
2903
> 
2903
+   getNamespace("graphics"))
2904
> cleanEx()
2904
> 
2905
> nameEx("recordGraphics")
2905
> 
2906
> ### * recordGraphics
2906
> 
2907
> 
2907
> graphics::par(get("par.postscript", pos = 'CheckExEnv'))
2908
> flush(stderr()); flush(stdout())
2908
> cleanEx()
2909
> 
2909
> nameEx("rgb")
2910
> ### Name: recordGraphics
2910
> ### * rgb
2911
> ### Title: Record Graphics Operations
2911
> 
2912
> ### Aliases: recordGraphics
2912
> flush(stderr()); flush(stdout())
2913
> ### Keywords: device
2913
> 
2914
> 
2914
> ### Name: rgb
2915
> ### ** Examples
2915
> ### Title: RGB Color Specification
2916
> 
2916
> ### Aliases: rgb
2917
> require(graphics)
2917
> ### Keywords: color
2918
> 
2918
> 
2919
> plot(1:10)
2919
> ### ** Examples
2920
> # This rectangle remains 1inch wide when the device is resized
2920
> 
2921
> recordGraphics(
2921
> rgb(0,1,0)
2922
+   {
2922
[1] "#00FF00"
2923
+     rect(4, 2,
2923
> 
2924
+          4 + diff(par("usr")[1:2])/par("pin")[1], 3)
2924
> rgb((0:15)/15, green=0, blue=0, names=paste("red",0:15,sep="."))
2925
+   },
2925
    red.0     red.1     red.2     red.3     red.4     red.5     red.6     red.7 
2926
+   list(),
2926
"#000000" "#110000" "#220000" "#330000" "#440000" "#550000" "#660000" "#770000" 
2927
+   getNamespace("graphics"))
2927
    red.8     red.9    red.10    red.11    red.12    red.13    red.14    red.15 
2928
> 
2928
"#880000" "#990000" "#AA0000" "#BB0000" "#CC0000" "#DD0000" "#EE0000" "#FF0000" 
2929
> 
2929
> 
2930
> 
2930
> rgb(0, 0:12, 0, max = 255)# integer input
2931
> graphics::par(get("par.postscript", pos = 'CheckExEnv'))
2931
 [1] "#000000" "#000100" "#000200" "#000300" "#000400" "#000500" "#000600"
2932
> cleanEx()
2932
 [8] "#000700" "#000800" "#000900" "#000A00" "#000B00" "#000C00"
2933
> nameEx("rgb")
2933
> 
2934
> ### * rgb
2934
> ramp <- colorRamp(c("red", "white"))
2935
> 
2935
> rgb( ramp(seq(0, 1, length = 5)), max = 255)
2936
> flush(stderr()); flush(stdout())
2936
[1] "#FF0000" "#FF3F3F" "#FF7F7F" "#FFBFBF" "#FFFFFF"
2937
> 
2937
> 
2938
> ### Name: rgb
2938
> 
2939
> ### Title: RGB Color Specification
2939
> 
2940
> ### Aliases: rgb
2940
> cleanEx()
2941
> ### Keywords: color
2941
> nameEx("rgb2hsv")
2942
> 
2942
> ### * rgb2hsv
2943
> ### ** Examples
2943
> 
2944
> 
2944
> flush(stderr()); flush(stdout())
2945
> rgb(0,1,0)
2945
> 
2946
[1] "#00FF00"
2946
> ### Name: rgb2hsv
2947
> 
2947
> ### Title: RGB to HSV Conversion
2948
> rgb((0:15)/15, green=0, blue=0, names=paste("red",0:15,sep="."))
2948
> ### Aliases: rgb2hsv
2949
    red.0     red.1     red.2     red.3     red.4     red.5     red.6     red.7 
2949
> ### Keywords: color dplot
2950
"#000000" "#110000" "#220000" "#330000" "#440000" "#550000" "#660000" "#770000" 
2950
> 
2951
    red.8     red.9    red.10    red.11    red.12    red.13    red.14    red.15 
2951
> ### ** Examples
2952
"#880000" "#990000" "#AA0000" "#BB0000" "#CC0000" "#DD0000" "#EE0000" "#FF0000" 
2952
> 
2953
> 
2953
> ## These (saturated, bright ones) only differ by hue
2954
> rgb(0, 0:12, 0, max = 255)# integer input
2954
> (rc <- col2rgb(c("red", "yellow","green","cyan", "blue", "magenta")))
2955
 [1] "#000000" "#000100" "#000200" "#000300" "#000400" "#000500" "#000600"
2955
      [,1] [,2] [,3] [,4] [,5] [,6]
2956
 [8] "#000700" "#000800" "#000900" "#000A00" "#000B00" "#000C00"
2956
red    255  255    0    0    0  255
2957
> 
2957
green    0  255  255  255    0    0
2958
> ramp <- colorRamp(c("red", "white"))
2958
blue     0    0    0  255  255  255
2959
> rgb( ramp(seq(0, 1, length = 5)), max = 255)
2959
> (hc <- rgb2hsv(rc))
2960
[1] "#FF0000" "#FF3F3F" "#FF7F7F" "#FFBFBF" "#FFFFFF"
2960
  [,1]      [,2]      [,3] [,4]      [,5]      [,6]
2961
> 
2961
h    0 0.1666667 0.3333333  0.5 0.6666667 0.8333333
2962
> 
2962
s    1 1.0000000 1.0000000  1.0 1.0000000 1.0000000
2963
> 
2963
v    1 1.0000000 1.0000000  1.0 1.0000000 1.0000000
2964
> cleanEx()
2964
> 6 * hc["h",] # the hues are equispaced
2965
> nameEx("rgb2hsv")
2965
[1] 0 1 2 3 4 5
2966
> ### * rgb2hsv
2966
> 
2967
> 
2967
> ## Don't show: 
2968
> flush(stderr()); flush(stdout())
2968
> set.seed(151)
2969
> 
2969
> ## End Don't show
2970
> ### Name: rgb2hsv
2970
> (rgb3 <- floor(256 * matrix(stats::runif(3*12), 3,12)))
2971
> ### Title: RGB to HSV Conversion
2971
     [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12]
2972
> ### Aliases: rgb2hsv
2972
[1,]  122  137  116  244   20  153  191  250  134   117    27   202
2973
> ### Keywords: color dplot
2973
[2,]  221  113  210  200  218  151   64  182  195   103   218   254
2974
> 
2974
[3,]  199  157   88   76   39   91   80  146   22   105    17   239
2975
> ### ** Examples
2975
> (hsv3 <- rgb2hsv(rgb3))
2976
> 
2976
       [,1]      [,2]      [,3]      [,4]      [,5]      [,6]      [,7]
2977
> ## These (saturated, bright ones) only differ by hue
2977
h 0.4629630 0.7575758 0.2950820 0.1230159 0.3493266 0.1612903 0.9790026
2978
> (rc <- col2rgb(c("red", "yellow","green","cyan", "blue", "magenta")))
2978
s 0.4479638 0.2802548 0.5809524 0.6885246 0.9082569 0.4052288 0.6649215
2979
      [,1] [,2] [,3] [,4] [,5] [,6]
2979
v 0.8666667 0.6156863 0.8235294 0.9568627 0.8549020 0.6000000 0.7490196
2980
red    255  255    0    0    0  255
2980
        [,8]      [,9]     [,10]     [,11]     [,12]
2981
green    0  255  255  255    0    0
2981
h 0.05769231 0.2254335 0.9761905 0.3250415 0.4519231
2982
blue     0    0    0  255  255  255
2982
s 0.41600000 0.8871795 0.1196581 0.9220183 0.2047244
2983
> (hc <- rgb2hsv(rc))
2983
v 0.98039216 0.7647059 0.4588235 0.8549020 0.9960784
2984
  [,1]      [,2]      [,3] [,4]      [,5]      [,6]
2984
> ## Consistency :
2985
h    0 0.1666667 0.3333333  0.5 0.6666667 0.8333333
2985
> stopifnot(rgb3 == col2rgb(hsv(h=hsv3[1,], s=hsv3[2,], v=hsv3[3,])),
2986
s    1 1.0000000 1.0000000  1.0 1.0000000 1.0000000
2986
+           all.equal(hsv3, rgb2hsv(rgb3/255, maxColorValue = 1)))
2987
v    1 1.0000000 1.0000000  1.0 1.0000000 1.0000000
2987
> 
2988
> 6 * hc["h",] # the hues are equispaced
2988
> ## A (simplified) pure R version -- originally by Wolfram Fischer --
2989
[1] 0 1 2 3 4 5
2989
> ## showing the exact algorithm:
2990
> 
2990
> rgb2hsvR <- function(rgb, gamma = 1, maxColorValue = 255)
2991
> ## Don't show: 
2991
+ {
2992
> set.seed(151)
2992
+     if(!is.numeric(rgb)) stop("rgb matrix must be numeric")
2993
> ## End Don't show
2993
+     d <- dim(rgb)
2994
> (rgb3 <- floor(256 * matrix(stats::runif(3*12), 3,12)))
2994
+     if(d[1] != 3) stop("rgb matrix must have 3 rows")
2995
     [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12]
2995
+     n <- d[2]
2996
[1,]  122  137  116  244   20  153  191  250  134   117    27   202
2996
+     if(n == 0) return(cbind(c(h=1,s=1,v=1))[,0])
2997
[2,]  221  113  210  200  218  151   64  182  195   103   218   254
2997
+     rgb <- rgb/maxColorValue
2998
[3,]  199  157   88   76   39   91   80  146   22   105    17   239
2998
+     if(gamma != 1) rgb <- rgb ^ (1/gamma)
2999
> (hsv3 <- rgb2hsv(rgb3))
2999
+ 
3000
       [,1]      [,2]      [,3]      [,4]      [,5]      [,6]      [,7]
3000
+     ## get the max and min
3001
h 0.4629630 0.7575758 0.2950820 0.1230159 0.3493266 0.1612903 0.9790026
3001
+     v <- apply( rgb, 2, max)
3002
s 0.4479638 0.2802548 0.5809524 0.6885246 0.9082569 0.4052288 0.6649215
3002
+     s <- apply( rgb, 2, min)
3003
v 0.8666667 0.6156863 0.8235294 0.9568627 0.8549020 0.6000000 0.7490196
3003
+     D <- v - s # range
3004
        [,8]      [,9]     [,10]     [,11]     [,12]
3004
+ 
3005
h 0.05769231 0.2254335 0.9761905 0.3250415 0.4519231
3005
+     ## set hue to zero for undefined values (gray has no hue)
3006
s 0.41600000 0.8871795 0.1196581 0.9220183 0.2047244
3006
+     h <- numeric(n)
3007
v 0.98039216 0.7647059 0.4588235 0.8549020 0.9960784
3007
+     notgray <- ( s != v )
3008
> ## Consistency :
3008
+ 
3009
> stopifnot(rgb3 == col2rgb(hsv(h=hsv3[1,], s=hsv3[2,], v=hsv3[3,])),
3009
+     ## blue hue
3010
+           all.equal(hsv3, rgb2hsv(rgb3/255, maxColorValue = 1)))
3010
+     idx <- (v == rgb[3,] & notgray )
3011
> 
3011
+     if (any (idx))
3012
> ## A (simplified) pure R version -- originally by Wolfram Fischer --
3012
+         h[idx] <- 2/3 + 1/6 * (rgb[1,idx] - rgb[2,idx]) / D[idx]
3013
> ## showing the exact algorithm:
3013
+     ## green hue
3014
> rgb2hsvR <- function(rgb, gamma = 1, maxColorValue = 255)
3014
+     idx <- (v == rgb[2,] & notgray )
3015
+ {
3015
+     if (any (idx))
3016
+     if(!is.numeric(rgb)) stop("rgb matrix must be numeric")
3016
+         h[idx] <- 1/3 + 1/6 * (rgb[3,idx] - rgb[1,idx]) / D[idx]
3017
+     d <- dim(rgb)
3017
+     ## red hue
3018
+     if(d[1] != 3) stop("rgb matrix must have 3 rows")
3018
+     idx <- (v == rgb[1,] & notgray )
3019
+     n <- d[2]
3019
+     if (any (idx))
3020
+     if(n == 0) return(cbind(c(h=1,s=1,v=1))[,0])
3020
+         h[idx] <-       1/6 * (rgb[2,idx] - rgb[3,idx]) / D[idx]
3021
+     rgb <- rgb/maxColorValue
3021
+ 
3022
+     if(gamma != 1) rgb <- rgb ^ (1/gamma)
3022
+     ## correct for negative red
3023
+ 
3023
+     idx <- (h < 0)
3024
+     ## get the max and min
3024
+     h[idx] <- 1+h[idx]
3025
+     v <- apply( rgb, 2, max)
3025
+ 
3026
+     s <- apply( rgb, 2, min)
3026
+     ## set the saturation
3027
+     D <- v - s # range
3027
+     s[! notgray] <- 0;
3028
+ 
3028
+     s[notgray] <- 1 - s[notgray] / v[notgray]
3029
+     ## set hue to zero for undefined values (gray has no hue)
3029
+ 
3030
+     h <- numeric(n)
3030
+     rbind( h=h, s=s, v=v )
3031
+     notgray <- ( s != v )
3031
+ }
3032
+ 
3032
> 
3033
+     ## blue hue
3033
> ## confirm the equivalence:
3034
+     idx <- (v == rgb[3,] & notgray )
3034
> all.equal(rgb2hsv (rgb3),
3035
+     if (any (idx))
3035
+           rgb2hsvR(rgb3), tol=1e-14) # TRUE
3036
+         h[idx] <- 2/3 + 1/6 * (rgb[1,idx] - rgb[2,idx]) / D[idx]
3036
[1] TRUE
3037
+     ## green hue
3037
> 
3038
+     idx <- (v == rgb[2,] & notgray )
3038
> 
3039
+     if (any (idx))
3039
> 
3040
+         h[idx] <- 1/3 + 1/6 * (rgb[3,idx] - rgb[1,idx]) / D[idx]
3040
> cleanEx()
3041
+     ## red hue
3041
> nameEx("trans3d")
3042
+     idx <- (v == rgb[1,] & notgray )
3042
> ### * trans3d
3043
+     if (any (idx))
3043
> 
3044
+         h[idx] <-       1/6 * (rgb[2,idx] - rgb[3,idx]) / D[idx]
3044
> flush(stderr()); flush(stdout())
3045
+ 
3045
> 
3046
+     ## correct for negative red
3046
> ### Name: trans3d
3047
+     idx <- (h < 0)
3047
> ### Title: 3D to 2D Transformation for Perspective Plots
3048
+     h[idx] <- 1+h[idx]
3048
> ### Aliases: trans3d
3049
+ 
3049
> ### Keywords: dplot
3050
+     ## set the saturation
3050
> 
3051
+     s[! notgray] <- 0;
3051
> ### ** Examples
3052
+     s[notgray] <- 1 - s[notgray] / v[notgray]
3052
> 
3053
+ 
3053
> ## See  help(persp) {after attaching the 'graphics' package}
3054
+     rbind( h=h, s=s, v=v )
3054
> ##      -----------
3055
+ }
3055
> 
3056
> 
3056
> 
3057
> ## confirm the equivalence:
3057
> 
3058
> all.equal(rgb2hsv (rgb3),
3058
> cleanEx()
3059
+           rgb2hsvR(rgb3), tol=1e-14) # TRUE
3059
> nameEx("xy.coords")
3060
[1] TRUE
3060
> ### * xy.coords
3061
> 
3061
> 
3062
> 
3062
> flush(stderr()); flush(stdout())
3063
> 
3063
> 
3064
> cleanEx()
3064
> ### Name: xy.coords
3065
> nameEx("trans3d")
3065
> ### Title: Extracting Plotting Structures
3066
> ### * trans3d
3066
> ### Aliases: xy.coords
3067
> 
3067
> ### Keywords: dplot
3068
> flush(stderr()); flush(stdout())
3068
> 
3069
> 
3069
> ### ** Examples
3070
> ### Name: trans3d
3070
> 
3071
> ### Title: 3D to 2D Transformation for Perspective Plots
3071
> xy.coords(stats::fft(c(1:9)), NULL)
3072
> ### Aliases: trans3d
3072
$x
3073
> ### Keywords: dplot
3073
[1] 45.0 -4.5 -4.5 -4.5 -4.5 -4.5 -4.5 -4.5 -4.5
3074
> 
3074
 
3075
> ### ** Examples
3075
$y
3076
> 
3076
[1]   0.0000000  12.3636484   5.3628912   2.5980762   0.7934714  -0.7934714
3077
> ## See  help(persp) {after attaching the 'graphics' package}
3077
[7]  -2.5980762  -5.3628912 -12.3636484
3078
> ##      -----------
3078
 
3079
> 
3079
$xlab
3080
> 
3080
[1] "Re()"
3081
> 
3081
 
3082
> cleanEx()
3082
$ylab
3083
> nameEx("xy.coords")
3083
[1] "Im()"
3084
> ### * xy.coords
3084
 
3085
> 
3085
> 
3086
> flush(stderr()); flush(stdout())
3086
> with(cars, xy.coords(dist ~ speed, NULL)$xlab ) # = "speed"
3087
> 
3087
[1] "speed"
3088
> ### Name: xy.coords
3088
> 
3089
> ### Title: Extracting Plotting Structures
3089
> xy.coords(1:3, 1:2, recycle=TRUE)
3090
> ### Aliases: xy.coords
3090
$x
3091
> ### Keywords: dplot
3091
[1] 1 2 3
3092
> 
3092
 
3093
> ### ** Examples
3093
$y
3094
> 
3094
[1] 1 2 1
3095
> xy.coords(stats::fft(c(1:9)), NULL)
3095
 
3096
$x
3096
$xlab
3097
[1] 45.0 -4.5 -4.5 -4.5 -4.5 -4.5 -4.5 -4.5 -4.5
3097
NULL
3098
 
3098
 
3099
$y
3099
$ylab
3100
[1]   0.0000000  12.3636484   5.3628912   2.5980762   0.7934714  -0.7934714
3100
NULL
3101
[7]  -2.5980762  -5.3628912 -12.3636484
3101
 
3102
 
3102
> xy.coords(-2:10,NULL, log="y")
3103
$xlab
3103
Warning in xy.coords(-2:10, NULL, log = "y") :
3104
[1] "Re()"
3104
  3 y values <= 0 omitted from logarithmic plot
3105
 
3105
$x
3106
$ylab
3106
 [1]  1  2  3  4  5  6  7  8  9 10 11 12 13
3107
[1] "Im()"
3107
 
3108
 
3108
$y
3109
> 
3109
 [1] NA NA NA  1  2  3  4  5  6  7  8  9 10
3110
> with(cars, xy.coords(dist ~ speed, NULL)$xlab ) # = "speed"
3110
 
3111
[1] "speed"
3111
$xlab
3112
> 
3112
[1] "Index"
3113
> xy.coords(1:3, 1:2, recycle=TRUE)
3113
 
3114
$x
3114
$ylab
3115
[1] 1 2 3
3115
NULL
3116
 
3116
 
3117
$y
3117
> ##> warning: 3 y values <=0 omitted ..
3118
[1] 1 2 1
3118
> 
3119
 
3119
> 
3120
$xlab
3120
> 
3121
NULL
3121
> cleanEx()
3122
 
3122
> nameEx("xyTable")
3123
$ylab
3123
> ### * xyTable
3124
NULL
3124
> 
3125
 
3125
> flush(stderr()); flush(stdout())
3126
> xy.coords(-2:10,NULL, log="y")
3126
> 
3127
Warning in xy.coords(-2:10, NULL, log = "y") :
3127
> ### Name: xyTable
3128
  3 y values <= 0 omitted from logarithmic plot
3128
> ### Title: Multiplicities of (x,y) Points, e.g., for a Sunflower Plot
3129
$x
3129
> ### Aliases: xyTable
3130
 [1]  1  2  3  4  5  6  7  8  9 10 11 12 13
3130
> ### Keywords: dplot
3131
 
3131
> 
3132
$y
3132
> ### ** Examples
3133
 [1] NA NA NA  1  2  3  4  5  6  7  8  9 10
3133
> 
3134
 
3134
> xyTable(iris[,3:4], digits = 6)
3135
$xlab
3135
$x
3136
[1] "Index"
3136
  [1] 1.0 1.1 1.2 1.3 1.3 1.3 1.4 1.4 1.4 1.5 1.5 1.5 1.5 1.6 1.6 1.6 1.7 1.7
3137
 
3137
 [19] 1.7 1.7 1.9 1.9 3.0 3.3 3.5 3.6 3.7 3.8 3.9 3.9 3.9 4.0 4.0 4.0 4.1 4.1
3138
$ylab
3138
 [37] 4.2 4.2 4.2 4.3 4.4 4.4 4.4 4.5 4.5 4.5 4.5 4.6 4.6 4.6 4.7 4.7 4.7 4.7
3139
NULL
3139
 [55] 4.8 4.8 4.9 4.9 4.9 5.0 5.0 5.0 5.0 5.1 5.1 5.1 5.1 5.1 5.1 5.1 5.2 5.2
3140
 
3140
 [73] 5.3 5.3 5.4 5.4 5.5 5.5 5.6 5.6 5.6 5.6 5.6 5.7 5.7 5.7 5.8 5.8 5.8 5.9
3141
> ##> warning: 3 y values <=0 omitted ..
3141
 [91] 5.9 6.0 6.0 6.1 6.1 6.1 6.3 6.4 6.6 6.7 6.7 6.9
3142
> 
3142
 
3143
> 
3143
$y
3144
> 
3144
  [1] 0.2 0.1 0.2 0.2 0.3 0.4 0.1 0.2 0.3 0.1 0.2 0.3 0.4 0.2 0.4 0.6 0.2 0.3
3145
> cleanEx()
3145
 [19] 0.4 0.5 0.2 0.4 1.1 1.0 1.0 1.3 1.0 1.1 1.1 1.2 1.4 1.0 1.2 1.3 1.0 1.3
3146
> nameEx("xyTable")
3146
 [37] 1.2 1.3 1.5 1.3 1.2 1.3 1.4 1.3 1.5 1.6 1.7 1.3 1.4 1.5 1.2 1.4 1.5 1.6
3147
> ### * xyTable
3147
 [55] 1.4 1.8 1.5 1.8 2.0 1.5 1.7 1.9 2.0 1.5 1.6 1.8 1.9 2.0 2.3 2.4 2.0 2.3
3148
> 
3148
 [73] 1.9 2.3 2.1 2.3 1.8 2.1 1.4 1.8 2.1 2.2 2.4 2.1 2.3 2.5 1.6 1.8 2.2 2.1
3149
> flush(stderr()); flush(stdout())
3149
 [91] 2.3 1.8 2.5 1.9 2.3 2.5 1.8 2.0 2.1 2.0 2.2 2.3
3150
> 
3150
 
3151
> ### Name: xyTable
3151
$number
3152
> ### Title: Multiplicities of (x,y) Points, e.g., for a Sunflower Plot
3152
  [1] 1 1 2 4 2 1 2 8 3 2 7 1 3 5 1 1 1 1 1 1 1 1 1 2 2 1 1 1 1 1 1 1 1 3 1 2 1
3153
> ### Aliases: xyTable
3153
 [38] 2 1 2 1 1 2 1 5 1 1 1 1 1 1 2 1 1 1 3 2 2 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1
3154
> ### Keywords: dplot
3154
 [75] 1 1 2 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
3155
> 
3155
 
3156
> ### ** Examples
3156
> 
3157
> 
3157
> ## Discretized uncorrelated Gaussian:
3158
> xyTable(iris[,3:4], digits = 6)
3158
> ## Don't show: 
3159
$x
3159
> set.seed(1)
3160
  [1] 1.0 1.1 1.2 1.3 1.3 1.3 1.4 1.4 1.4 1.5 1.5 1.5 1.5 1.6 1.6 1.6 1.7 1.7
3160
> ## End Don't show
3161
 [19] 1.7 1.7 1.9 1.9 3.0 3.3 3.5 3.6 3.7 3.8 3.9 3.9 3.9 4.0 4.0 4.0 4.1 4.1
3161
> require(stats)
3162
 [37] 4.2 4.2 4.2 4.3 4.4 4.4 4.4 4.5 4.5 4.5 4.5 4.6 4.6 4.6 4.7 4.7 4.7 4.7
3162
> xy <- data.frame(x = round(sort(rnorm(100))), y = rnorm(100))
3163
 [55] 4.8 4.8 4.9 4.9 4.9 5.0 5.0 5.0 5.0 5.1 5.1 5.1 5.1 5.1 5.1 5.1 5.2 5.2
3163
> xyTable(xy, digits = 1)
3164
 [73] 5.3 5.3 5.4 5.4 5.5 5.5 5.6 5.6 5.6 5.6 5.6 5.7 5.7 5.7 5.8 5.8 5.8 5.9
3164
$x
3165
 [91] 5.9 6.0 6.0 6.1 6.1 6.1 6.3 6.4 6.6 6.7 6.7 6.9
3165
 [1] -2 -2 -2 -2 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1  0  0  0  0  0  0  0  0
3166
 
3166
[26]  0  0  0  0  0  0  0  0  0  0  0  0  0  0  1  1  1  1  1  1  1  1  1  1  1
3167
$y
3167
[51]  1  1  1  1  1  1  2  2  2  2
3168
  [1] 0.2 0.1 0.2 0.2 0.3 0.4 0.1 0.2 0.3 0.1 0.2 0.3 0.4 0.2 0.4 0.6 0.2 0.3
3168
 
3169
 [19] 0.4 0.5 0.2 0.4 1.1 1.0 1.0 1.3 1.0 1.1 1.1 1.2 1.4 1.0 1.2 1.3 1.0 1.3
3169
$y
3170
 [37] 1.2 1.3 1.5 1.3 1.2 1.3 1.4 1.3 1.5 1.6 1.7 1.3 1.4 1.5 1.2 1.4 1.5 1.6
3170
 [1] -0.90 -0.60  0.04  0.20 -0.70 -0.60 -0.50 -0.40 -0.30 -0.20 -0.10  0.40
3171
 [55] 1.4 1.8 1.5 1.8 2.0 1.5 1.7 1.9 2.0 1.5 1.6 1.8 1.9 2.0 2.3 2.4 2.0 2.3
3171
[13]  0.50  0.70  0.90  1.00  2.00 -2.00 -1.00 -0.90 -0.80 -0.70 -0.60 -0.50
3172
 [73] 1.9 2.3 2.1 2.3 1.8 2.1 1.4 1.8 2.1 2.2 2.4 2.1 2.3 2.5 1.6 1.8 2.2 2.1
3172
[25] -0.30 -0.20 -0.07 -0.06 -0.04 -0.02  0.02  0.06  0.30  0.40  0.50  0.70
3173
 [91] 2.3 1.8 2.5 1.9 2.3 2.5 1.8 2.0 2.1 2.0 2.2 2.3
3173
[37]  0.90  1.00  2.00 -1.00 -0.90 -0.80 -0.70 -0.40 -0.30 -0.20 -0.10 -0.08
3174
 
3174
[49] -0.03  0.10  0.20  0.40  0.50  0.80  1.00  2.00 -1.00 -0.40  0.40  1.00
3175
$number
3175
 
3176
  [1] 1 1 2 4 2 1 2 8 3 2 7 1 3 5 1 1 1 1 1 1 1 1 1 2 2 1 1 1 1 1 1 1 1 3 1 2 1
3176
$number
3177
 [38] 2 1 2 1 1 2 1 5 1 1 1 1 1 1 2 1 1 1 3 2 2 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1
3177
 [1] 1 1 1 1 2 1 2 1 2 4 1 1 1 1 1 2 2 5 5 1 1 2 3 2 3 1 1 1 1 1 1 1 1 1 2 1 1 3
3178
 [75] 1 1 2 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
3178
[39] 3 3 1 1 1 1 2 2 1 1 1 1 2 1 2 2 4 2 3 1 1 1
3179
 
3179
 
3180
> 
3180
> 
3181
> ## Discretized uncorrelated Gaussian:
3181
> 
3182
> ## Don't show: 
3182
> 
3183
> set.seed(1)
3183
> cleanEx()
3184
> ## End Don't show
3184
> nameEx("xyz.coords")
3185
> require(stats)
3185
> ### * xyz.coords
3186
> xy <- data.frame(x = round(sort(rnorm(100))), y = rnorm(100))
3186
> 
3187
> xyTable(xy, digits = 1)
3187
> flush(stderr()); flush(stdout())
3188
$x
3188
> 
3189
 [1] -2 -2 -2 -2 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1  0  0  0  0  0  0  0  0
3189
> ### Name: xyz.coords
3190
[26]  0  0  0  0  0  0  0  0  0  0  0  0  0  0  1  1  1  1  1  1  1  1  1  1  1
3190
> ### Title: Extracting Plotting Structures
3191
[51]  1  1  1  1  1  1  2  2  2  2
3191
> ### Aliases: xyz.coords
3192
 
3192
> ### Keywords: dplot
3193
$y
3193
> 
3194
 [1] -0.90 -0.60  0.04  0.20 -0.70 -0.60 -0.50 -0.40 -0.30 -0.20 -0.10  0.40
3194
> ### ** Examples
3195
[13]  0.50  0.70  0.90  1.00  2.00 -2.00 -1.00 -0.90 -0.80 -0.70 -0.60 -0.50
3195
> 
3196
[25] -0.30 -0.20 -0.07 -0.06 -0.04 -0.02  0.02  0.06  0.30  0.40  0.50  0.70
3196
> xyz.coords(data.frame(10*1:9, -4), y = NULL, z = NULL)
3197
[37]  0.90  1.00  2.00 -1.00 -0.90 -0.80 -0.70 -0.40 -0.30 -0.20 -0.10 -0.08
3197
$x
3198
[49] -0.03  0.10  0.20  0.40  0.50  0.80  1.00  2.00 -1.00 -0.40  0.40  1.00
3198
[1] 1 2 3 4 5 6 7 8 9
3199
 
3199
 
3200
$number
3200
$y
3201
 [1] 1 1 1 1 2 1 2 1 2 4 1 1 1 1 1 2 2 5 5 1 1 2 3 2 3 1 1 1 1 1 1 1 1 1 2 1 1 3
3201
[1] 10 20 30 40 50 60 70 80 90
3202
[39] 3 3 1 1 1 1 2 2 1 1 1 1 2 1 2 2 4 2 3 1 1 1
3202
 
3203
 
3203
$z
3204
> 
3204
[1] -4 -4 -4 -4 -4 -4 -4 -4 -4
3205
> 
3205
 
3206
> 
3206
$xlab
3207
> cleanEx()
3207
[1] "Index"
3208
> nameEx("xyz.coords")
3208
 
3209
> ### * xyz.coords
3209
$ylab
3210
> 
3210
NULL
3211
> flush(stderr()); flush(stdout())
3211
 
3212
> 
3212
$zlab
3213
> ### Name: xyz.coords
3213
NULL
3214
> ### Title: Extracting Plotting Structures
3214
 
3215
> ### Aliases: xyz.coords
3215
> 
3216
> ### Keywords: dplot
3216
> xyz.coords(1:5, stats::fft(1:5), z = NULL, xlab = "X", ylab = "Y")
3217
> 
3217
$x
3218
> ### ** Examples
3218
[1] 15.0 -2.5 -2.5 -2.5 -2.5
3219
> 
3219
 
3220
> xyz.coords(data.frame(10*1:9, -4), y = NULL, z = NULL)
3220
$y
3221
$x
3221
[1]  0.0000000  3.4409548  0.8122992 -0.8122992 -3.4409548
3222
[1] 1 2 3 4 5 6 7 8 9
3222
 
3223
 
3223
$z
3224
$y
3224
[1] 1 2 3 4 5
3225
[1] 10 20 30 40 50 60 70 80 90
3225
 
3226
 
3226
$xlab
3227
$z
3227
[1] "Re(Y)"
3228
[1] -4 -4 -4 -4 -4 -4 -4 -4 -4
3228
 
3229
 
3229
$ylab
3230
$xlab
3230
[1] "Im(Y)"
3231
[1] "Index"
3231
 
3232
 
3232
$zlab
3233
$ylab
3233
[1] "X"
3234
NULL
3234
 
3235
 
3235
> 
3236
$zlab
3236
> y <- 2 * (x2 <- 10 + (x1 <- 1:10))
3237
NULL
3237
> xyz.coords(y ~ x1 + x2, y = NULL, z = NULL)
3238
 
3238
$x
3239
> 
3239
 [1]  1  2  3  4  5  6  7  8  9 10
3240
> xyz.coords(1:5, stats::fft(1:5), z = NULL, xlab = "X", ylab = "Y")
3240
 
3241
$x
3241
$y
3242
[1] 15.0 -2.5 -2.5 -2.5 -2.5
3242
 [1] 11 12 13 14 15 16 17 18 19 20
3243
 
3243
 
3244
$y
3244
$z
3245
[1]  0.0000000  3.4409548  0.8122992 -0.8122992 -3.4409548
3245
 [1] 22 24 26 28 30 32 34 36 38 40
3246
 
3246
 
3247
$z
3247
$xlab
3248
[1] 1 2 3 4 5
3248
[1] "x1"
3249
 
3249
 
3250
$xlab
3250
$ylab
3251
[1] "Re(Y)"
3251
[1] "x2"
3252
 
3252
 
3253
$ylab
3253
$zlab
3254
[1] "Im(Y)"
3254
[1] "y"
3255
 
3255
 
3256
$zlab
3256
> 
3257
[1] "X"
3257
> xyz.coords(data.frame(x = -1:9, y = 2:12, z = 3:13), y = NULL, z = NULL,
3258
 
3258
+            log = "xy")
3259
> 
3259
Warning in xyz.coords(data.frame(x = -1:9, y = 2:12, z = 3:13), y = NULL,  :
3260
> y <- 2 * (x2 <- 10 + (x1 <- 1:10))
3260
  2 x values <= 0 omitted from logarithmic plot
3261
> xyz.coords(y ~ x1 + x2, y = NULL, z = NULL)
3261
$x
3262
$x
3262
 [1] NA NA  1  2  3  4  5  6  7  8  9
3263
 [1]  1  2  3  4  5  6  7  8  9 10
3263
 
3264
 
3264
$y
3265
$y
3265
 [1]  2  3  4  5  6  7  8  9 10 11 12
3266
 [1] 11 12 13 14 15 16 17 18 19 20
3266
 
3267
 
3267
$z
3268
$z
3268
 [1]  3  4  5  6  7  8  9 10 11 12 13
3269
 [1] 22 24 26 28 30 32 34 36 38 40
3269
 
3270
 
3270
$xlab
3271
$xlab
3271
[1] "x"
3272
[1] "x1"
3272
 
3273
 
3273
$ylab
3274
$ylab
3274
[1] "y"
3275
[1] "x2"
3275
 
3276
 
3276
$zlab
3277
$zlab
3277
[1] "z"
3278
[1] "y"
3278
 
3279
 
3279
> ##> Warning message: 2 x values <= 0 omitted ...
3280
> 
3280
> 
3281
> xyz.coords(data.frame(x = -1:9, y = 2:12, z = 3:13), y = NULL, z = NULL,
3281
> 
3282
+            log = "xy")
3282
> 
3283
Warning in xyz.coords(data.frame(x = -1:9, y = 2:12, z = 3:13), y = NULL,  :
3283
> ### * <FOOTER>
3284
  2 x values <= 0 omitted from logarithmic plot
3284
> ###
3285
$x
3285
> cat("Time elapsed: ", proc.time() - get("ptime", pos = 'CheckExEnv'),"\n")
3286
 [1] NA NA  1  2  3  4  5  6  7  8  9
3286
Time elapsed:  8.22 1.94 10.2 NA NA 
3287
 
3287
> grDevices::dev.off()
3288
$y
3288
null device 
3289
 [1]  2  3  4  5  6  7  8  9 10 11 12
3289
          1 
3290
 
3290
> ###
3291
$z
3291
> ### Local variables: ***
3292
 [1]  3  4  5  6  7  8  9 10 11 12 13
3292
> ### mode: outline-minor ***
3293
 
3293
> ### outline-regexp: "\\(> \\)?### [*]+" ***
3294
$xlab
3294
> ### End: ***
3295
[1] "x"
3295
> quit('no')
3296
 
-
 
3297
$ylab
-
 
3298
[1] "y"
-
 
3299
 
-
 
3300
$zlab
-
 
3301
[1] "z"
-
 
3302
 
-
 
3303
> ##> Warning message: 2 x values <= 0 omitted ...
-
 
3304
> 
-
 
3305
> 
-
 
3306
> 
-
 
3307
> ### * <FOOTER>
-
 
3308
> ###
-
 
3309
> cat("Time elapsed: ", proc.time() - get("ptime", pos = 'CheckExEnv'),"\n")
-
 
3310
Time elapsed:  3.49 0.114 3.767 0 0 
-
 
3311
> grDevices::dev.off()
-
 
3312
null device 
-
 
3313
          1 
-
 
3314
> ###
-
 
3315
> ### Local variables: ***
-
 
3316
> ### mode: outline-minor ***
-
 
3317
> ### outline-regexp: "\\(> \\)?### [*]+" ***
-
 
3318
> ### End: ***
-
 
3319
> quit('no')
-