## A practical guide to ecological modelling – Chapter 9

``````## =============================================================================
## R-Code to make figure 9.6 from the book:
## K. Soetaert  and  P.M.J. Herman, 2009.
## A practical guide to ecological modelling -
## using R as a simulation platform. Springer, 372 pp.
## http://www.springer.com/life+sciences/ecology/book/978-1-4020-8623-6 .
## implemented by Karline Soetaert
## =============================================================================

par(mar = c(2, 2, 2, 2))
# Define the stages
Stagenames  <- c("dormant seeds 1yr", "dormant seeds 2yr",
"small rosettes<2.5cm", "medium rosettes 2.5-18.9cm",
"large rosettes>19cm ", "flowering plants")
names       <- c("DS 1yr", "DS 2yr",
"R small", "R medium",
"R large", "F")

NumStages  <- length(Stagenames)

# Population matrix
A        <- matrix(nrow = NumStages, ncol = NumStages, byrow = TRUE,
data = c(        0,      0,      0,      0,      0,      322.38,
0.966,  0,      0,      0,      0,      0     ,
0.013,  0.01,   0.125,  0,      0,      3.448 ,
0.007,  0,      0.125,  0.238,  0,      30.170,
0.008,  0,      0.038,  0.245,  0.167,  0.862 ,
0,      0,      0,      0.023,  0.75,   0      )  )

# curvature of arrows
curves   <- A
curves[] <- 0
curves[3,1] <- -0.35
curves[4,6] <- curves[6,4] <- curves[5,6] <- curves[6,5] <- 0.08
curves[3,6]<-  0.35
curves[1,6]<- -0.35

# plot the population matrix
plotmat(A, pos = c(3, 2, 1), curve = curves, name = names,
lwd = 1, box.lwd = 2, my = -0.1, cex.txt = 0.8,
box.cex = 0.8, box.size = 0.08, box.type = "circle", box.prop = 1,
relsize = 0.95, shadow.size = 0.01, self.cex = 0.6,
self.shiftx = c(0, 0, 0.125, -0.12, 0.125, 0), self.shifty = 0)

legend("bottomright", cex = 0.8,
legend = c("DS = dormant seeds", "R  = rosettes", "F  = flowers"))
legend("bottomleft", ncol = 2, cex = 0.8,
legend = c("small", "medium", "large", "<2.5cm", "2.5-18.9cm", ">19cm"))
mtext(side = 3, "Dipsacus sylvestris", cex = 1.25, line = 0)``````

Go back