# functions
x <- seq(from=-2.5, to=2.5, by=0.1)
# load
data_out <- read.csv("TrendsAndTriggers-v2.csv")
## do
x2d <- matrix(NA, ncol = 3, nrow = 0)
xindex <- c(rep(-1.9, 5),
-1.7, -1.5 , -1.3, -1.1, 0, 1.1, 1.3, 1.5, 1.7
, rep(2, 4))
j <- 1
xind <- xindex[j]
for(index in c(1:5,rep(5,8), 6:10)){
x2d <- rbind(x2d, subset(data_out, y == index & x == xind))
j <- j + 1
xind <- xindex[j]
}
# x2d
#png("/images/TrendsAndTriggers-v2.1.gif")
setwd("images")
saveGIF(
{
ani.options(interval = 0.2)
for(ith in 100:140){
layout(matrix(c(1,2,1,3,1,4), 3, 2, byrow = TRUE), widths=c(2,1), heights=c(2,2,2))
# layout.show(4)
res <- persp(x, 1:10, matrix(data_out$z, ncol = 10, nrow = length(x)),
ylab= "y", xlab= "x", zlab = "z",
theta = ith,
phi = 42, ltheta = 120, shade = 0.75,
expand = 0.5, col = "lightgrey")
lines (trans3d(x2d$x, x2d$y, x2d$z, pmat = res), col = "red", lwd = 4)
plot(x2d$x, x2d$y, type = "l", xlab="x", ylab="y")
plot(x2d$x, x2d$z, type = "l", xlab="x", ylab="z")
plot(x2d$y, x2d$z, type = "l", xlab="y", ylab="z")
}
}
outdir = getwd(), movie.name = "TrendsAndTriggers-v2.1.gif"
)
setwd("..")
# dev.off()