Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- x <- replicate(8, arima.sim(list(ar = 0.1, ma = 2.5), 4))
- preylabs <- paste("Prey", 1:4) # for plotting
- ## the ugly way ----
- library(compactr) # a very nice convenience package for ploting
- eplot(xlim = c(1, 4), ylim = c(-9, 10),
- xat = 1:4, xticklab = preylabs,
- ylab = "Time", main = "Ugly")
- invisible(apply(x, 2, function(xj) {
- points(xj, pch = 16)
- lines(xj)
- }))
- ## checkerboard ----
- checkercols <- colorRamp(c("white", "black"))((1:20)/20) / 255
- checkercols <- apply(checkercols, 1, function (x) rgb(x[1], x[2], x[3]))
- image(x, col = checkercols, xaxt = "n", yaxt = "n")
- axis(1, at = (0:3) / 3, labels = preylabs)
- axis(2, at = (0:7) / 7, labels = 1:8)
- mtext("Individual", 2, line = 2)
- title(main = "I like these", outer = TRUE, line = -1.5)
- ## small multiples ----
- op <- par
- par(mfrow = c(2, 4),
- mar = rep(0.75, 4),
- oma = c(2.5, 2.5, 3, 1))
- invisible(apply(x, 2, function (xj) {
- eplot(xlim = c(1, 4), ylim = c(-9, 10), xat = 1:4)
- points(xj, pch = 16)
- lines(xj)
- }))
- title(main = "These can be good, too", outer = TRUE, cex.main = 1.5)
- mtext("Time", 2, line = 1, outer = TRUE)
- mtext("Prey", 1, line = 1, outer = TRUE)
- par(op)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement