Historical Time-Series

knitr::opts_chunk$set(echo = TRUE)
library(dplyr)
Pars <- params$Pars$Hist
nsim <- dim(Pars@TSdata$VB)[1]
nyears <- dim(Pars@TSdata$VB)[2]


CurrentYr <- params$Pars$CurrentYr
histYr <- (CurrentYr-nyears+1):CurrentYr
futYr <- (CurrentYr+1):(CurrentYr+proyears)
Years <- histYr
if (params$tabs) {
  cat('### Spawning Biomass {.tabset .tabset-fade .tabset-pills}' )
} else {
  cat('### Spawning Biomass')
}

Depletion

par(mfrow=c(1,1), oma=c(3,3,1,1), mar=c(1,1,1,1))

Depletion <- Pars@TSdata$SSB/matrix(Pars@Ref$SSB0, nrow=nsim, ncol=nyears)
ylim <- c(0, max(Depletion))
matplot(Years, t(Depletion),
        type="l", lty=1, bty="l", main="", 
         lwd=params$plotPars$lwd, ylab="Depletion (spawning biomass)", xlab="Historical Years", las=1, xpd=NA,
        ylim=ylim)
abline(h=1, lty=2, lwd=2, col="darkgray")

Absolute

par(mfrow=c(1,1), oma=c(3,3,1,1), mar=c(1,1,1,1))

SSB <- Pars@TSdata$SSB
ylim <- c(0, max(SSB))
matplot(Years, t(SSB),
        type="l", lty=1, bty="l", main="", 
         lwd=params$plotPars$lwd, ylab="SSB", xlab="Historical Years", las=1, xpd=NA,
        ylim=ylim)
if (params$tabs) {
  cat('### Vulnerable Biomass {.tabset .tabset-fade .tabset-pills}' )
} else {
  cat('### Vulnerable Biomass')
}

Depletion

par(mfrow=c(1,1), oma=c(3,3,1,1), mar=c(1,1,1,1))

Depletion <- Pars@TSdata$VB/matrix(Pars@Ref$VB0, nrow=nsim, ncol=nyears)
ylim <- c(0, max(Depletion))
matplot(Years, t(Depletion),
        type="l", lty=1, bty="l", main="", 
         lwd=params$plotPars$lwd, ylab="Depletion (vulnerable biomass)", xlab="Historical Years", las=1, xpd=NA,
        ylim=ylim)
abline(h=1, lty=2, lwd=2, col="darkgray")

Absolute

par(mfrow=c(1,1), oma=c(3,3,1,1), mar=c(1,1,1,1))

Vb <- Pars@TSdata$VB
ylim <- c(0, max(Vb))
matplot(Years, t(Vb),
        type="l", lty=1, bty="l", main="", 
         lwd=params$plotPars$lwd, ylab="Vuln. Biomass", xlab="Historical Years", las=1, xpd=NA,
        ylim=ylim)
if (params$tabs) {
  cat('### Total Biomass {.tabset .tabset-fade .tabset-pills}' )
} else {
  cat('### Total Biomass')
}

Depletion

par(mfrow=c(1,1), oma=c(3,3,1,1), mar=c(1,1,1,1))

Depletion <- Pars@TSdata$B/matrix(Pars@Ref$B0, nrow=nsim, ncol=nyears)
ylim <- c(0, max(Depletion))
matplot(Years, t(Depletion),
        type="l", lty=1, bty="l", main="", 
         lwd=params$plotPars$lwd, ylab="Depletion (total biomass)", xlab="Historical Years", las=1, xpd=NA,
        ylim=ylim)
abline(h=1, lty=2, lwd=2, col="darkgray")

Absolute

par(mfrow=c(1,1), oma=c(3,3,1,1), mar=c(1,1,1,1))


B <- Pars@TSdata$B
ylim <- c(0, max(B))
matplot(Years, t(B),
        type="l", lty=1, bty="l", main="", 
         lwd=params$plotPars$lwd, ylab="Total Biomass", xlab="Historical Years", las=1, xpd=NA,
        ylim=ylim)
if (params$tabs) {
  cat('### Recruitment {.tabset .tabset-fade .tabset-pills}' )
} else {
  cat('### Recruitment')
}

Relative

par(mfrow=c(1,1), oma=c(3,3,1,1), mar=c(1,1,1,1))

Depletion <- Pars@TSdata$Rec/matrix(Pars@Ref$R0, nrow=nsim, ncol=nyears)
ylim <- c(0, max(Depletion))
matplot(Years, t(Depletion),
        type="l", lty=1, bty="l", main="", 
         lwd=params$plotPars$lwd, ylab="Recruitment (relative to R0)", xlab="Historical Years", las=1, xpd=NA,
        ylim=ylim)
abline(h=1, lty=2, lwd=2, col="darkgray")

Absolute

par(mfrow=c(1,1), oma=c(3,3,1,1), mar=c(1,1,1,1))

Rec <- Pars@TSdata$Rec
ylim <- c(0, max(Rec))
matplot(Years, t(Rec),
        type="l", lty=1, bty="l", main="", 
         lwd=params$plotPars$lwd, ylab="Recruitment", xlab="Historical Years", las=1, xpd=NA,
        ylim=ylim)
if (params$tabs) {
  cat('### Catch {.tabset .tabset-fade .tabset-pills}' )
} else {
  cat('### Catch')
}

Relative

par(mfrow=c(1,1), oma=c(3,3,1,1), mar=c(1,1,1,1))

Depletion <- Pars@TSdata$Catch/matrix(Pars@TSdata$Catch[,nyears], nrow=nsim, ncol=nyears)
ylim <- c(0, max(Depletion))
matplot(Years, t(Depletion),
        type="l", lty=1, bty="l", main="", 
         lwd=params$plotPars$lwd, ylab="Catch (relative to current year)", xlab="Historical Years", las=1, xpd=NA,
        ylim=ylim)
abline(h=1, lty=2, lwd=2, col="darkgray")

Absolute

par(mfrow=c(1,1), oma=c(3,3,1,1), mar=c(1,1,1,1))

Catch <- Pars@TSdata$Catch
ylim <- c(0, max(Catch))
matplot(Years, t(Catch),
        type="l", lty=1, bty="l", main="", 
         lwd=params$plotPars$lwd, ylab="Catch", xlab="Historical Years", las=1, xpd=NA,
        ylim=ylim)
if (params$tabs) {
  cat('### Historical Fishing Mortality {.tabset .tabset-fade .tabset-pills}' )
} else {
  cat('### Historical Fishing Mortality')
}

Historical Time-Series

par(mfrow=c(1,1), oma=c(3,3,1,1), mar=c(1,1,1,1))

Find <- Pars@TSdata$Find
ylim <- c(0, max(Find))
matplot(Years, t(Find),
        type="l", lty=1, bty="l", main="", 
         lwd=params$plotPars$lwd, ylab="Fishing mortality rate (apical)", xlab="Historical Years", las=1, xpd=NA,
        ylim=ylim)
abline(h=1, lty=2, lwd=2, col="darkgray")


DLMtool/DLMtool documentation built on June 20, 2021, 5:20 p.m.