Skip to content

Commit

Permalink
fix(plot_spawning_biomass): Remove complications
Browse files Browse the repository at this point in the history
Just have a standard plot and not all the if else statements by using
simple ifelse statements in the code. Also, removed plots for non-standard
output per Sam's guidance.

* There was a problem with `if(any(grepl("target", output$label)))` because it
  ignored what the user specified in `ref_line` if target is present in label,
  i.e., you could never get to MSY. There should be a two-level check, i.e.,
  what does the user want and is it present. I have not fixed this latter
  problem.
* Fixed use of `..., ]$estimate` to `..., "estimate"]` because you should not
  use the dollar sign which allows for partial matches.
* Use `switch()` statements instead of nested `if` `else` statements. Actually,
  now the function is so simple that I do not even have any switch statements
  but they can be helpful instead of nested if else statements.
* Fixed the non-relative plots to truncate data to only use years less than end_yr
* Some of the scaled items were hard-coded to 1000 instead of using scale_amount
* Removed show_warnings because it was not actually doing anything
* Use end_year rather than renaming it to endyr
* Subset sb to end year before determining the correct number of breaks
* MSY does not work so I removed it from the default reference list, only
  target and unfished work
* Need to fix:
  * units are not divided by scale amount to create new unit label
  * Why do we think that our determination of breaks is better than what ggplot2
    provides?
  * There is no example
  • Loading branch information
kellijohnson-NOAA committed Oct 1, 2024
1 parent 1641eba commit cc83d44
Show file tree
Hide file tree
Showing 5 changed files with 141 additions and 390 deletions.
1 change: 1 addition & 0 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ Imports:
dplyr,
flextable,
ggplot2,
glue,
naniar,
nmfspalette,
stringr,
Expand Down
3 changes: 2 additions & 1 deletion R/plot_recruitment.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#' Plot Recruitment
#'
#' @inheritParams plot_recruitment
#' @param dat A path to a file name where the data are stored.
#' @param model The model type, to be deprecated.
#' @param params Print/export the parameters of the stock recruitment function?
#' @param params_only Only export the stock recruitment function or both the parameters and the plot(s)?
#' @param units If units are not available in the output file, in metric tons,
Expand Down
Loading

0 comments on commit cc83d44

Please sign in to comment.