Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Need to free up ylim= in plot.catchCurve() #70

Closed
droglenc opened this issue Mar 29, 2021 · 1 comment
Closed

Need to free up ylim= in plot.catchCurve() #70

droglenc opened this issue Mar 29, 2021 · 1 comment
Labels

Comments

@droglenc
Copy link
Contributor

The current version of plot.catchCurve() hard-wires the y-axis limits. This should be fixed to allow the user to set the limits. The following change works but it may be better to have ylim=NULL in the function definition, query if it is NULL, and the set the default limits as shown.

plot.catchCurve <- function(x,pos.est="topright",cex.est=0.95,
                            ylab="log(Catch)",xlab="Age",
                            col.pt="gray30",col.mdl="black",lwd=2,lty=1,
                            ylim=c(min(0,min(log(x$catch),na.rm=TRUE)),max(log(x$catch),na.rm=TRUE)),
                            ...) {
  # nocov start
  # Plot raw data
  graphics::plot(log(x$catch)~x$age,col=col.pt,xlab=xlab,ylab=ylab,ylim=ylim,...)
  # Highlight descending limb portion
  graphics::points(x$age.e,x$log.catch.e,col=col.pt,pch=19)
  # Put model on descending limb
  graphics::lines(x$age.e,stats::predict(x$lm,data.frame(x$age.e)),lwd=lwd,lty=lty,col=col.mdl)
  # Put mortality values on the plot
  if (!is.null(pos.est)) {
    Z <- -stats::coef(x$lm)[2]
    A <- 100*(1-exp(-Z))
    graphics::legend(pos.est,legend=paste0("Z=",round(Z,3),"\nA=",round(A,1),"%"),
                     bty="n",cex=cex.est)
  }
} # nocov end

This function was written a long time ago. Probably worth making other edits (e.g., not hard-wiring the rounding values).

Thanks to Brendan Runde ... North Carolina State.

@droglenc droglenc added the bug label Mar 29, 2021
@droglenc
Copy link
Contributor Author

droglenc commented May 6, 2021

Fixed in v0.9.0

@droglenc droglenc closed this as completed May 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant