if (FALSE) {
# The quakes data
with(quakes, {
rp.plot4d(cbind(long, lat), depth)
rp.plot4d(cbind(long, lat), depth, mag)
})
# SO2 over Europe
with(SO2, {
location <- cbind(longitude, latitude)
if (require(mgcv) & require(maps)) {
location1 <- location[,1]
location2 <- location[,2]
model <- gam(logSO2 ~ s(location1, location2, year))
loc1 <- seq(min(location1), max(location1), length = 30)
loc2 <- seq(min(location2), max(location2), length = 30)
yr <- seq(min(year), max(year), length = 30)
newdata <- expand.grid(loc1, loc2, yr)
names(newdata) <- c("location1", "location2", "year")
model <- predict(model, newdata)
model <- list(x = cbind(loc1, loc2), z = yr,
y = array(model, dim = rep(30, 3)))
mapxy <- map('world', plot = FALSE,
xlim = range(longitude), ylim = range(latitude))
rp.plot4d(location, year, logSO2, model,
col.palette = rev(heat.colors(20)),
foreground.plot = function() map(mapxy, add = TRUE))
}
else
rp.plot4d(location, year, logSO2, col.palette = rev(heat.colors(20)))
})
# Dissolved Oxygen in the River Clyde
with(Clyde, {
rp.plot4d(cbind(Doy, DO), Station, location.plot = FALSE)
rp.plot4d(cbind(Station, DO), Doy, location.plot = FALSE)
rp.plot4d(cbind(Station, Doy), Year, DO)
# Highlight the data before and after a sewage treatment plant update in 1985
ind <- Year >= 80 & Year <= 89 & !(Year == 85)
year <- Year[ind] + Doy[ind] / 365
station <- Station[ind]
doy <- Doy[ind]
do <- DO[ind]
group <- factor(c("after 1985", "before 1985")[1 +
as.numeric(year < 85)])
rp.plot4d(cbind(doy, do), station, group,
col.palette = c("red", "green"), location.plot = FALSE)
})
}
Run the code above in your browser using DataLab