xyplot(ts(c(1:10,10:1)))
### Figure 14.1 from Sarkar (2008)
xyplot(sunspot.year, aspect = "xy",
strip = FALSE, strip.left = TRUE,
cut = list(number = 4, overlap = 0.05))
### A multivariate example; first juxtaposed, then superposed
xyplot(EuStockMarkets, scales = list(y = "same"))
xyplot(EuStockMarkets, superpose = TRUE, aspect = "xy", lwd = 2,
type = c("l","g"), ylim = c(0, max(EuStockMarkets)))
### Examples using screens (these two are identical)
xyplot(EuStockMarkets, screens = c(rep("Continental", 3), "UK"))
xyplot(EuStockMarkets, screens = list(FTSE = "UK", "Continental"))
### Automatic group styles
xyplot(EuStockMarkets, screens = list(FTSE = "UK", "Continental"),
superpose = TRUE)
xyplot(EuStockMarkets, screens = list(FTSE = "UK", "Continental"),
superpose = TRUE, xlim = extendrange(1996:1998),
par.settings = standard.theme(color = FALSE))
### Specifying styles for series by name
xyplot(EuStockMarkets, screens = list(FTSE = "UK", "Continental"),
col = list(DAX = "red", FTSE = "blue", "black"), auto.key = TRUE)
xyplot(EuStockMarkets, screens = list(FTSE = "UK", "Continental"),
col = list(DAX = "red"), lty = list(SMI = 2), lwd = 1:2,
auto.key = TRUE)
### Example with simpler data, few data points
set.seed(1)
z <- ts(cbind(a = 1:5, b = 11:15, c = 21:25) + rnorm(5))
xyplot(z, screens = 1)
xyplot(z, screens = list(a = "primary (a)", "other (b & c)"),
type = list(a = c("p", "h"), b = c("p", "s"), "o"),
pch = list(a = 2, c = 3), auto.key = list(type = "o"))
Run the code above in your browser using DataLab