Skip to content

[Fix] plot_spawning_biomass when user wants to use DERIVED_QUANTITIES from SS3#222

Open
Schiano-NOAA wants to merge 2 commits intodevfrom
fix-sb-plt-219
Open

[Fix] plot_spawning_biomass when user wants to use DERIVED_QUANTITIES from SS3#222
Schiano-NOAA wants to merge 2 commits intodevfrom
fix-sb-plt-219

Conversation

@Schiano-NOAA
Copy link
Copy Markdown
Collaborator

Summary

An issue was identified in plot_spawning_biomass (and most likely our other plots) when wanting to access specific data. After some investigation, "DERIVED_QUANTITIES" is found in the converted dataset when era = NULL; however there was still an issue finishing the plot because era = NULL in the reference line results in an error. The issue was identified in #219

The fix:

  • adjust reference line to take our era and use plot data instead

Additional changes

  • took out a conditional section when era = NULL plotting horizontal break lines (this is doing too much and not needed)

@JoelRice-NOAA could you take a look at this and confirm this is working for you now? The best way to do this is the following:

remotes::install_github("nmfs-ost/stockplotr@fix-sb-plt-219")
# using your example file
albacore <- stockplotr::convert_output(output_file)
stockplotr::plot_spawning_biomass(
  dat = albacore,
  era = NULL # this is a key change
  ref_line = c("target" = 10e6),
  unit_label = "mt",
  scale_amount = 1e6,
  relative = TRUE,
  module = "DERIVED_QUANTITIES"
)

This is what I am getting from the example file in stockplotr:

plot_spawning_biomass(stockplotr::example_data, era = NULL)
image

* add in optional ggplot args

* adjust process data so grouping is correctly adjusted based on model condition and grouping

* change default model as 1 from NA

* set plot to look for only recruitment and not rec exp or obs

* allow users to access ggplot geom args

* fix maggritr in pipe
@Schiano-NOAA Schiano-NOAA marked this pull request as ready for review April 6, 2026 12:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant