Welcome to my Open Notebook

This is an Open Notebook with Selected Content - Delayed. All content is licenced with CC-BY. Find out more Here.

ONS-SCD.png

add-2d-plots-of-trend-and-wiggle-to-catastrophic-regime-shifts-plot

Catastrophic Regime Shifts Visualisation

Catastrophic Regime Shifts Visualisation


1 Try adding 2D plot of the trend overtime and the variation within basins of attraction

  • Following on from the previous work I now want to calculate the 2D paths.
  • This will then form the basis for a "walk through" animation
  • Either with recorded narration or annotations that appear at the right time to describe each transition
  • This is most of what I want to include except I have not added the wiggly variations around the main trend line, that show the system varying within the basin of attraction
  • I got advice that Blender3d was the best way to finish this off. Any other suggestions?

1.1 figure

/images/TrendsAndTriggers-v2.1.gif

1.2 code

# 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()

Posted in  ecosocial tipping points


blog comments powered by Disqus