figure.exploitation.rate = function(p, all.areas=TRUE, outdir, CFA4X.exclude.year.assessment=TRUE ) {
if (all.areas) {
areas = c("cfa4x", "cfasouth", "cfanorth" )
regions = c("4X", "S-ENS", "N-ENS")
} else {
areas = c("cfasouth", "cfanorth" )
regions = c("S-ENS", "N-ENS")
}
td = exploitationrates(p=p, areas=areas, labels=regions, CFA4X.exclude.year.assessment=CFA4X.exclude.year.assessment )
n.regions = length(regions)
npanels = length(areas)
varstoplot = matrix(ncol=3, byrow=T, data=c( "R0.mass", "Exploitation rate", "") )
nvarstoplot = dim(varstoplot)[1]
i=1
v = "exploitation.rate"
tt = varstoplot[i,2]
yy = "Proportion of total fishable biomass"
xlim=range(td$yr);
xlim[1]=xlim[1]-0.5;
xlim[2]=xlim[2]+0.5
ylim=range(0, 0.81)
dir.create( outdir, recursive=T, showWarnings=F )
fn = file.path( outdir, "exploitation.rate.png" )
png( filename=fn, width=3072, height=2304, pointsize=30, res=300 )
setup.lattice.options()
pl = xyplot( total~yr|region, data=td, ub=td$ub, lb=td$lb,
layout=c(1,n.regions), xlim=xlim, ylim=ylim,
par.strip.text = list(cex=1.0),
par.settings=list(
axis.text=list(cex=1),
par.main.text = list(cex=1.5),
layout.heights=list(strip=1, panel=1, main=0.5 )
),
main=tt, xlab=list("Year",cex=1.5), ylab=list(yy,cex=1.5) ,
panel = function(x, y, subscripts, ub, lb, ...) {
larrows(x, lb[subscripts], x, ub[subscripts], angle = 90, code = 3, length=0.02, lwd=3)
panel.xyplot(x, y, type="b", lty=1, lwd=6, pch=30, col="black", ...)
panel.abline(v=2001.5, col="gray", lty=1, lwd=5, ...)
panel.abline(h=0, col="black", lty=1, lwd=5, ...)
panel.abline(h=mean(y,na.rm=TRUE), col="gray", lty=2, lwd=3, ...)
}
)
print(fn)
print(pl)
dev.off()
table.view( td )
return(td)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.