| 1 |
|
1 |
|
| 2 |
R : Copyright 2003, The R Development Core Team
|
2 |
R : Copyright 2003, The R Development Core Team
|
| 3 |
Version 1.9.0 Under development (unstable) (2003-10-21)
|
3 |
Version 1.9.0 Under development (unstable) (2003-10-21)
|
| 4 |
|
4 |
|
| 5 |
R is free software and comes with ABSOLUTELY NO WARRANTY.
|
5 |
R is free software and comes with ABSOLUTELY NO WARRANTY.
|
| 6 |
You are welcome to redistribute it under certain conditions.
|
6 |
You are welcome to redistribute it under certain conditions.
|
| 7 |
Type 'license()' or 'licence()' for distribution details.
|
7 |
Type 'license()' or 'licence()' for distribution details.
|
| 8 |
|
8 |
|
| 9 |
R is a collaborative project with many contributors.
|
9 |
R is a collaborative project with many contributors.
|
| 10 |
Type 'contributors()' for more information.
|
10 |
Type 'contributors()' for more information.
|
| 11 |
|
11 |
|
| 12 |
Type 'demo()' for some demos, 'help()' for on-line help, or
|
12 |
Type 'demo()' for some demos, 'help()' for on-line help, or
|
| 13 |
'help.start()' for a HTML browser interface to help.
|
13 |
'help.start()' for a HTML browser interface to help.
|
| 14 |
Type 'q()' to quit R.
|
14 |
Type 'q()' to quit R.
|
| 15 |
|
15 |
|
| 16 |
> #### Regression tests for GRAPHICS & PLOTS
|
16 |
> #### Regression tests for GRAPHICS & PLOTS
|
| 17 |
>
|
17 |
>
|
| 18 |
> postscript("reg-plot.ps", paper="a4", horizontal=TRUE,
|
18 |
> postscript("reg-plot.ps", paper="a4", horizontal=TRUE,
|
| 19 |
+ encoding ="ISOLatin1.enc")
|
19 |
+ encoding ="ISOLatin1.enc")
|
| 20 |
> ## since we supply the font metrics, the results depend only on
|
20 |
> ## since we supply the font metrics, the results depend only on
|
| 21 |
> ## the encoding used: Windows is different from Unix by default.
|
21 |
> ## the encoding used: Windows is different from Unix by default.
|
| 22 |
>
|
22 |
>
|
| 23 |
> options(warn = 1)# print them as they occur
|
23 |
> options(warn = 1)# print them as they occur
|
| 24 |
>
|
24 |
>
|
| 25 |
> plot(0) # this should remain constant
|
25 |
> plot(0) # this should remain constant
|
| 26 |
> str(par(c("usr","xaxp","yaxp")))
|
26 |
> str(par(c("usr","xaxp","yaxp")))
|
| 27 |
List of 3
|
27 |
List of 3
|
| 28 |
$ usr : num [1:4] 0.568 1.432 -1.080 1.080
|
28 |
$ usr : num [1:4] 0.568 1.432 -1.080 1.080
|
| 29 |
$ xaxp: num [1:3] 0.6 1.4 4.0
|
29 |
$ xaxp: num [1:3] 0.6 1.4 4.0
|
| 30 |
$ yaxp: num [1:3] -1 1 4
|
30 |
$ yaxp: num [1:3] -1 1 4
|
| 31 |
>
|
31 |
>
|
| 32 |
>
|
32 |
>
|
| 33 |
>
|
33 |
>
|
| 34 |
> ### Test for centring of chars. All the chars which are plotted should
|
34 |
> ### Test for centring of chars. All the chars which are plotted should
|
| 35 |
> ### be centred, and there should be no warnings about
|
35 |
> ### be centred, and there should be no warnings about
|
| 36 |
> ### font metrics unknown for character `?'
|
36 |
> ### font metrics unknown for character `?'
|
| 37 |
>
|
37 |
>
|
| 38 |
> par(pty="s")
|
38 |
> par(pty="s")
|
| 39 |
> plot(c(-1,16), c(-1,16), type="n", xlab="", ylab="", xaxs="i", yaxs="i")
|
39 |
> plot(c(-1,16), c(-1,16), type="n", xlab="", ylab="", xaxs="i", yaxs="i")
|
| 40 |
> title("Centred chars in default char set (ISO Latin1)")
|
40 |
> title("Centred chars in default char set (ISO Latin1)")
|
| 41 |
> grid(17, 17, lty=1)
|
41 |
> grid(17, 17, lty=1)
|
| 42 |
> known <- c(32:126, 144:152, 154, 155, 157:255)
|
42 |
> known <- c(32:126, 144:152, 154, 155, 157:255)
|
| 43 |
>
|
43 |
>
|
| 44 |
> for(i in known) {
|
44 |
> for(i in known) {
|
| 45 |
+ x <- i %% 16
|
45 |
+ x <- i %% 16
|
| 46 |
+ y <- i %/% 16
|
46 |
+ y <- i %/% 16
|
| 47 |
+ points(x, y, pch=i)
|
47 |
+ points(x, y, pch=i)
|
| 48 |
+ }
|
48 |
+ }
|
| 49 |
>
|
49 |
>
|
| 50 |
> par(pty="m")
|
50 |
> par(pty="m")
|
| 51 |
>
|
51 |
>
|
| 52 |
> ## PR 816 (label sizes in dotchart)
|
52 |
> ## PR 816 (label sizes in dotchart)
|
| 53 |
>
|
53 |
>
|
| 54 |
> ### Prior to 1.2.2, the label sizes were unaffected by cex.
|
54 |
> ### Prior to 1.2.2, the label sizes were unaffected by cex.
|
| 55 |
>
|
55 |
>
|
| 56 |
> data(VADeaths)
|
56 |
> data(VADeaths)
|
| 57 |
> dotchart(VADeaths, main = "Death Rates in Virginia - 1940", cex = 0.5)
|
57 |
> dotchart(VADeaths, main = "Death Rates in Virginia - 1940", cex = 0.5)
|
| 58 |
> dotchart(VADeaths, main = "Death Rates in Virginia - 1940", cex = 1.5)
|
58 |
> dotchart(VADeaths, main = "Death Rates in Virginia - 1940", cex = 1.5)
|
| 59 |
>
|
59 |
>
|
| 60 |
> ## killed by 0 prior to 1.4.0 and in 1.4.1:
|
60 |
> ## killed by 0 prior to 1.4.0 and in 1.4.1:
|
| 61 |
> t1 <- ts(0:100)
|
61 |
> t1 <- ts(0:100)
|
| 62 |
> ## only warnings about values <= 0
|
62 |
> ## only warnings about values <= 0
|
| 63 |
> plot(t1, log = "y")
|
63 |
> plot(t1, log = "y")
|
| 64 |
Warning in xy.coords(x, NULL, log = log) : 1 y value <= 0 omitted from logarithmic plot
|
64 |
Warning in xy.coords(x, NULL, log = log) : 1 y value <= 0 omitted from logarithmic plot
|
| 65 |
> plot(cbind(t1, 10*t1, t1 - 4), log="y", plot.type = "single")
|
65 |
> plot(cbind(t1, 10*t1, t1 - 4), log="y", plot.type = "single")
|
| 66 |
Warning in xy.coords(x = matrix(rep.int(tx, k), ncol = k), y = x, log = log) :
|
66 |
Warning in xy.coords(x = matrix(rep.int(tx, k), ncol = k), y = x, log = log) :
|
| 67 |
7 y values <= 0 omitted from logarithmic plot
|
67 |
7 y values <= 0 omitted from logarithmic plot
|
| 68 |
> stopifnot(par("usr")[4] > 3) # log10: ylim[2] = 1000
|
68 |
> stopifnot(par("usr")[4] > 3) # log10: ylim[2] = 1000
|
| 69 |
>
|
69 |
>
|
| 70 |
>
|
70 |
>
|
| 71 |
> ## This one needs to be looked at.
|
71 |
> ## This one needs to be looked at.
|
| 72 |
> ## lty = "blank" killed the fill colour too.
|
72 |
> ## lty = "blank" killed the fill colour too.
|
| 73 |
> plot(1:10, type="n")
|
73 |
> plot(1:10, type="n")
|
| 74 |
> polygon(c(1, 3, 3, 1), c(1, 1, 3, 3), col="yellow", border="red", lty="blank")
|
74 |
> polygon(c(1, 3, 3, 1), c(1, 1, 3, 3), col="yellow", border="red", lty="blank")
|
| 75 |
> rect(6, 6, 10, 10, col="blue", border="red", lty="blank")
|
75 |
> rect(6, 6, 10, 10, col="blue", border="red", lty="blank")
|
| 76 |
> ## in 1.5.0 all omit the fill colours.
|
76 |
> ## in 1.5.0 all omit the fill colours.
|
| 77 |
> data(trees)
|
77 |
> data(trees)
|
| 78 |
> with(trees, symbols(Height, Volume, circles=Girth/24, inches=FALSE,
|
78 |
> with(trees, symbols(Height, Volume, circles=Girth/24, inches=FALSE,
|
| 79 |
+ lty="blank", bg="blue"))
|
79 |
+ lty="blank", bg="blue"))
|
| 80 |
> ## in 1.5.0 ignored the lty.
|
80 |
> ## in 1.5.0 ignored the lty.
|
| 81 |
>
|
81 |
>
|
| 82 |
> ## axis() and par(mgp < 0) {keep this example S+ compatible!}:
|
82 |
> ## axis() and par(mgp < 0) {keep this example S+ compatible!}:
|
| 83 |
> lt <- if(is.R()) "31" else 2
|
83 |
> lt <- if(is.R()) "31" else 2
|
| 84 |
> x <- seq(-2,3, len=1001)
|
84 |
> x <- seq(-2,3, len=1001)
|
| 85 |
> op <- par(tck= +0.02, mgp = -c(3,2,0))
|
85 |
> op <- par(tck= +0.02, mgp = -c(3,2,0))
|
| 86 |
> plot(x, x^2 - 1.2, xaxt = "n", xlab="", type ='l', col = 2,
|
86 |
> plot(x, x^2 - 1.2, xaxt = "n", xlab="", type ='l', col = 2,
|
| 87 |
+ main = "mgp < 0: all ticks and labels inside `frame'")
|
87 |
+ main = "mgp < 0: all ticks and labels inside `frame'")
|
| 88 |
> x <- -2:3
|
88 |
> x <- -2:3
|
| 89 |
> lines(x, x^2 - 1.2, type ="h", col = 3, lwd=3)
|
89 |
> lines(x, x^2 - 1.2, type ="h", col = 3, lwd=3)
|
| 90 |
> axis(1, pos = 0, at=-1:1, lty = lt, col=4)## col & lty work only from R 1.6
|
90 |
> axis(1, pos = 0, at=-1:1, lty = lt, col=4)## col & lty work only from R 1.6
|
| 91 |
> par(op)
|
91 |
> par(op)
|
| 92 |
> axis(1, pos = 0, at=c(-2,2,3), lty = lt, col=4)
|
92 |
> axis(1, pos = 0, at=c(-2,2,3), lty = lt, col=4)
|
| 93 |
> mtext(side=1,"note the x-ticks on the other side of the bars")
|
93 |
> mtext(side=1,"note the x-ticks on the other side of the bars")
|
| 94 |
>
|
94 |
>
|
| 95 |
> ## plot.table(): explicit xlab and ylab for non-1D
|
95 |
> ## plot.table(): explicit xlab and ylab for non-1D
|
| 96 |
> data(UCBAdmissions)
|
96 |
> data(UCBAdmissions)
|
| 97 |
> plot(UCBAdmissions)# default x- and y-lab
|
97 |
> plot(UCBAdmissions)# default x- and y-lab
|
| 98 |
> plot(UCBAdmissions, xlab = "x label", ylab = "YY")# wrong in 1.5.1
|
98 |
> plot(UCBAdmissions, xlab = "x label", ylab = "YY")# wrong in 1.5.1
|
| 99 |
> ## axis suppression
|
99 |
> ## axis suppression
|
| 100 |
> plot(tt <- table(c(rep(0,7), rep(1,4), rep(5, 3))), axes = FALSE)
|
100 |
> plot(tt <- table(c(rep(0,7), rep(1,4), rep(5, 3))), axes = FALSE)
|
| 101 |
> plot(tt, xaxt = "n")
|
101 |
> plot(tt, xaxt = "n")
|
| 102 |
> ## wrong till (incl.) 1.6.x
|
102 |
> ## wrong till (incl.) 1.6.x
|
| 103 |
>
|
103 |
>
|
| 104 |
> ## legend with call
|
104 |
> ## legend with call
|
| 105 |
> lo <- legend(2,2, substitute(hat(theta) == that, list(that= pi)))
|
105 |
> lo <- legend(2,2, substitute(hat(theta) == that, list(that= pi)))
|
| 106 |
> stopifnot(length(lo$text$x) == 1)
|
106 |
> stopifnot(length(lo$text$x) == 1)
|
| 107 |
> ## length() was 3 till 1.7.x
|
107 |
> ## length() was 3 till 1.7.x
|
| 108 |
>
|
108 |
>
|
| 109 |
> library(stepfun)
|
- |
|
| 110 |
> plot(ecdf(c(1:4,8,12)), ylab = "ECDF", main=NULL)
|
109 |
> plot(ecdf(c(1:4,8,12)), ylab = "ECDF", main=NULL)
|
| 111 |
> ## ylab didn't work till 1.8.0
|
110 |
> ## ylab didn't work till 1.8.0
|
| 112 |
>
|
111 |
>
|