## =======================================================================
## image and points
## =======================================================================
image2Drgl(z = volcano, contour = TRUE, main = "volcano")
scatter2Drgl(x = seq(0, 1, by = 0.2), y = seq(0, 1, by = 0.2),
cex = 3, add = TRUE)
if (FALSE) {
cutrgl() # select a rectangle
uncutrgl()
}
## =======================================================================
## scatter points, and lines
## =======================================================================
scatter2Drgl(cars[,1], cars[,2], xlab = "speed", ylab = "dist")
if (FALSE) {
cutrgl()
}
lc <- lowess(cars)
scatter2Drgl(lc$x, lc$y, type = "l", add = TRUE, lwd = 4)
if (FALSE) {
cutrgl()
uncutrgl()
}
## =======================================================================
## confidence intervals
## =======================================================================
x <- sort(rnorm(10))
y <- runif(10)
cv <- sqrt(x^2 + y^2)
CI <- list(lwd = 2)
CI$x <- matrix (nrow = length(x), ncol = 2, data = rep(0.125, 2*length(x)))
scatter2D(x, y, colvar = cv, pch = 16, cex = 2, CI = CI)
scatter2Drgl(x, y, colvar = cv, cex = 2, CI = CI)
## =======================================================================
## arrows
## =======================================================================
arrows2Drgl(x0 = 100*runif(30), y0 = runif(30), x1 = 100*runif(30),
y1 = runif(30), length = 0.1*runif(30), col = 1:30, angle = 15:45,
type = c("simple", "triangle"), lwd = 2)
x0 <- 1:30
x1 <- 2:31
arrows2Drgl(x0 = x0, y0 = sin(x0), x1 = x1, y1 = sin(x1),
colvar = x1, lwd = 2)
Run the code above in your browser using DataLab