---
params: 
    title: ""
    Pars: "`r list()`"
    plotPars: "`r list()`"
    tabs: "`r TRUE`"
    its: " `r numeric()`"
    nyears: " `r numeric()`"
    proyears: " `r numeric()`"
    date: "`r Sys.Date()`"
title: "`r params$title`"
date: "`r params$date`"
output:
  html_document
---


```{r, echo=FALSE, results="asis"}
if (params$tabs) {
  cat('### Spatial & Movement {.tabset .tabset-fade .tabset-pills}' )
} else {
  cat('### Spatial & Movement')
}

dd <- params$Pars$M_ageArray %>% dim()
nsim <- dd[1]
maxage <- dd[2]

nsamp <- length(params$its)

if (Pars$SRrel[1] == 1) SR <- "Beverton-Holt"
if (Pars$SRrel[1] == 2) SR <- "Ricker"

```

#### Sampled Parameters 
Histograms of `r nsim` simulations of size of area 1 (`Size_area_1`), fraction of unfished biomass in area 1 (`Frac_area_1`), and the probability of staying in area 1 in a year (`Frac_area_1`), with vertical colored lines indicating `r nsamp` randomly drawn values used in other plots:

```{r, echo=FALSE}
par(mfrow=c(1,3))
hist2(Pars$Size_area_1, col=params$plotPars$col, axes=params$plotPars$axes, main="Size_area_1", breaks=params$plotPars$breaks)
abline(v=Pars$Size_area_1[params$its], col=1:nsamp, lwd=params$plotPars$lwd)
axis(side=1)  

hist2(Pars$Frac_area_1, col=params$plotPars$col, axes=params$plotPars$axes, main="Frac_area_1", breaks=params$plotPars$breaks)
abline(v=Pars$Frac_area_1[params$its], col=1:nsamp, lwd=params$plotPars$lwd)
axis(side=1) 

hist2(Pars$Prob_staying, col=params$plotPars$col, axes=params$plotPars$axes, main="Prob_staying", breaks=params$plotPars$breaks)
abline(v=Pars$Prob_staying[params$its], col=1:nsamp, lwd=params$plotPars$lwd)
axis(side=1)

```

