The R Project SVN R

Rev

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

Rev 72405 Rev 75448
Line 179... Line 179...
179
        main = "Petal and Sepal Dimensions in Iris Blossoms")
179
        main = "Petal and Sepal Dimensions in Iris Blossoms")
180
for (i in seq(cexv)) {
180
for (i in seq(cexv)) {
181
  text  (1, y.leg[i] - 0.1, paste("cex=", formatC(cexv[i])), cex = 0.8, adj = 0)
181
  text  (1, y.leg[i] - 0.1, paste("cex=", formatC(cexv[i])), cex = 0.8, adj = 0)
182
  legend(3, y.leg[i], leg.txt, pch = "sSvV", col = c(1, 3), cex = cexv[i])
182
  legend(3, y.leg[i], leg.txt, pch = "sSvV", col = c(1, 3), cex = cexv[i])
183
}
183
}
-
 
184
## cex *vector* [in R <= 3.5.1 has 'if(xc < 0)' w/ length(xc) == 2]
-
 
185
legend(6,1, leg.txt, pch = "sSvV", col = c(1, 3), cex = 1+(-1:2)/8)
184
 
186
 
185
## 'merge = TRUE' for merging lines & points:
187
## 'merge = TRUE' for merging lines & points:
186
x <- seq(-pi, pi, len = 65)
188
x <- seq(-pi, pi, len = 65)
187
plot(x, sin(x), type = "l", ylim = c(-1.2, 1.8), col = 3, lty = 2)
189
plot(x, sin(x), type = "l", ylim = c(-1.2, 1.8), col = 3, lty = 2)
188
points(x, cos(x), pch = 3, col = 4)
190
points(x, cos(x), pch = 3, col = 4)
Line 270... Line 272...
270
points(x, y, pch = 21, bg = "white")
272
points(x, y, pch = 21, bg = "white")
271
legend(.4,1, "sin(c x)", pch = 21, pt.bg = "white", lty = 1, col = "blue")
273
legend(.4,1, "sin(c x)", pch = 21, pt.bg = "white", lty = 1, col = "blue")
272
 
274
 
273
## legends with titles at different locations
275
## legends with titles at different locations
274
plot(x, y, type = "n")
276
plot(x, y, type = "n")
275
legend("bottomright", "(x,y)", pch = 1, title = "bottomright")
277
legend("bottomright", "(x,y)", pch=1, title= "bottomright")
276
legend("bottom", "(x,y)", pch = 1, title = "bottom")
278
legend("bottom",      "(x,y)", pch=1, title= "bottom")
277
legend("bottomleft", "(x,y)", pch = 1, title = "bottomleft")
279
legend("bottomleft",  "(x,y)", pch=1, title= "bottomleft")
278
legend("left", "(x,y)", pch = 1, title = "left")
280
legend("left",        "(x,y)", pch=1, title= "left")
279
legend("topleft", "(x,y)", pch = 1, title = "topleft, inset = .05",
281
legend("topleft",     "(x,y)", pch=1, title= "topleft, inset = .05", inset = .05)
280
       inset = .05)
-
 
281
legend("top", "(x,y)", pch = 1, title = "top")
282
legend("top",         "(x,y)", pch=1, title= "top")
282
legend("topright", "(x,y)", pch = 1, title = "topright, inset = .02",
283
legend("topright",    "(x,y)", pch=1, title= "topright, inset = .02",inset = .02)
283
       inset = .02)
-
 
284
legend("right", "(x,y)", pch = 1, title = "right")
284
legend("right",       "(x,y)", pch=1, title= "right")
285
legend("center", "(x,y)", pch = 1, title = "center")
285
legend("center",      "(x,y)", pch=1, title= "center")
286
 
286
 
287
# using text.font (and text.col):
287
# using text.font (and text.col):
288
op <- par(mfrow = c(2, 2), mar = rep(2.1, 4))
288
op <- par(mfrow = c(2, 2), mar = rep(2.1, 4))
289
c6 <- terrain.colors(10)[1:6]
289
c6 <- terrain.colors(10)[1:6]
290
for(i in 1:4) {
290
for(i in 1:4) {