Earth quakes
## =======================================================================
## A composite 3D-figure: the quakes data set
## implemented by Karline Soetaert
## =======================================================================
require(plot3D)
lon <- seq(165.5, 188.5, length.out = 30)
lat <- seq(-38.5, -10, length.out = 30)
xy <- table(cut(quakes$long, lon),
cut(quakes$lat, lat))
xmid <- 0.5*(lon[-1] + lon[-length(lon)])
ymid <- 0.5*(lat[-1] + lat[-length(lat)])
par (mar = par("mar") + c(0, 0, 0, 2))
hist3D(x = xmid, y = ymid, z = xy,
zlim = c(-20, 40), main = "Earth quakes",
ylab = "latitude", xlab = "longitude",
zlab = "counts", bty= "g", phi = 5, theta = 25,
shade = 0.2, col = "white", border = "black",
d = 1, ticktype = "detailed")
with (quakes, scatter3D(x = long, y = lat,
z = rep(-20, length.out = length(long)),
colvar = quakes$depth, col = gg.col(100),
add = TRUE, pch = 18, clab = c("depth", "m"),
colkey = list(length = 0.5, width = 0.5,
dist = 0.05, cex.axis = 0.8, cex.clab = 0.8)
))
# TRY:
# require(plot3Drgl)
# plotrlg()
Go back