#' @export
ExploitationRatePlots <- function(data,usr=NULL,lrp=NULL,French= F, lfa=NULL,fd=file.path(project.figuredirectory('bio.lobster','ReferencePoints')),save=T, title = paste('LFA',lfa),fn=paste0('ExploitationRefs',lfa),runM=T,...) {
dir.create( fd, recursive = TRUE, showWarnings = FALSE )
xlab='Year'
ylab='Exploitation Index'
if (French){
xlab='Annee'
ylab=paste0("Indice d'exploitation")
}
plot(data[,1],data[,2],xlab=xlab,ylab=ylab,type='n',main=title,ylim=c(0,1),...)
polygon(c(data[,1],rev(data[,1])),c(data[,3],rev(data[,4])),col='grey',border=NA)
lines(data[,1],data[,2],lwd=2,pch=16,type='o')
if(runM){
data$running.median = rmed(data[,1],data[,2])$x
lines(data[,1],data$running.median,col='blue',lty=2,lwd=3)
}
#lines(data[,1],data[,4],col='grey',lty=2,lwd=1)
if(!is.null(usr)) abline(h=usr,col='green',lwd=2,lty=2)
if(!is.null(lrp)) abline(h=lrp,col='red',lwd=2,lty=3)
#readline(prompt="Press [enter] to continue")
if (save) {savePlot(file.path(fd,paste(fn,'.png',sep='')),type='png')}
write.csv(data,file.path(fd,paste(fn,'.csv',sep='')))
print(lfa)
return(data)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.