Skip to content

Plot retrospectives - #509

Merged
Schiano-NOAA merged 39 commits into
nmfs-ost:mainfrom
JZahner1:plot_retrospectives
Nov 18, 2026
Merged

Schiano-NOAA merged 39 commits into
nmfs-ost:mainfrom
JZahner1:plot_retrospectives

Conversation

@JZahner1

@JZahner1 JZahner1 commented Nov 17, 2026 •

Copy link
Copy Markdown
Collaborator

What is the feature?

  • Allows for plotting retrospective peels of any quantity for which a plot_* function already exists (currently this is plot_biomass, plot_spawning_biomass, plot_fishing_mortality, plot_recruitment, plot_spr).

How have you implemented the solution?

  • This feature builds upon the base multi-model processing feature that was previously merged. The plot_retrospectives function acts mostly as a data formatting wrapper that allows users to specify how many years to peel off the terminal data year for each model. Points on the terminal data year can also be added to the plot, akin to the plots generated in r4ss.

Does the PR impact any other area of the project, maybe another repo?

  • This MAY duplicate plotting code that is present in FIMS.

PR contribution checklist

Thank you for contributing to stockplotr! Please check the boxes below to confirm this pull request (PR) is ready for review. Edit this PR description to add the release indicator and any explanations.

  • I have read and adhered to the contributor guide.
  • I have kept this PR focused on one plot where applicable. For multiple features, I have used separate PRs (stacked PRs are welcome if needed).
  • I have aimed to keep this PR to no more than 750 lines, excluding tests and example data (for example, up to 750 lines for a new function).
  • If I have provided an example dataset, I have explained why the existing sample datasets are not sufficient.
  • I have tested that my changes are compatible with all example outputs in the "data" folder (example_data.rda; pollock.rda; ss3_simple.rda; vermilion_snapper.rda).
  • If I didn't follow the development workflow, I have explained why in this PR.
  • If applicable, I've added the plot to save_all_plots() and updated the associated tests in test-save_all_plots.R.
  • After opening this PR, I have checked that my own tests and spellcheck pass (spelling::spell_check_package()). If other checks fail, I have flagged them for the package maintainers to help diagnose and remedy.
  • I have requested review from one package maintainer (Sam or Sophie).

pass a list of model files and get back a single tibble object of all models concatenated together
Test against two SS3 models and a combination of SS3 and Rceattle models.
Multimodel data processing is now handled natively by `convert_output`
Verify that `filter_data` works on two models and that ` plot_spawning_biomass` generates a plot with two lines.
wrapper function for producing a plot of retrospective peels for any quantity with an existing plot_* function
…s Rho

External calcualtions allowed only so as to not enforce methodology (definition of mohn's rho changes by science center).
@JZahner1

Copy link
Copy Markdown
Collaborator Author

@sbreitbart-NOAA regarding our conversation yesterday about captions/alttext for retrospectives, the current way of using create_rda relies on the intermediate CSV files. If the plan is to eventually move away from those, then I think it might be better to just not implement captions/alttext for retrospective plots for right now, and update them later with the new workflow.

I can throw a CLI message if make_rda=TRUE stating as much for now, so its not confusing for users.

@sbreitbart-NOAA

Copy link
Copy Markdown
Collaborator

@sbreitbart-NOAA regarding our conversation yesterday about captions/alttext for retrospectives, the current way of using create_rda relies on the intermediate CSV files. If the plan is to eventually move away from those, then I think it might be better to just not implement captions/alttext for retrospective plots for right now, and update them later with the new workflow.

I can throw a CLI message if make_rda=TRUE stating as much for now, so its not confusing for users.

I'm considering a different idea: provide some semblance of a caption/alt text (not the typical data-driven ones- a static one, without placeholders, for now). I think that would help ensure the pipeline still adds a caption and alt text object to the rda, and to the asar report, which the users can (and should) edit. That way, they'll have something to edit, vs. starting from scratch. If we do this, we'd add a caption and alt text to the template csv. Then, we'd alert the user that they should update the caption and alt text for accuracy and descriptiveness until we develop functionality to create data-driven versions. Thoughts, @Schiano-NOAA ?

@JZahner1

Copy link
Copy Markdown
Collaborator Author

@sbreitbart-NOAA regarding our conversation yesterday about captions/alttext for retrospectives, the current way of using create_rda relies on the intermediate CSV files. If the plan is to eventually move away from those, then I think it might be better to just not implement captions/alttext for retrospective plots for right now, and update them later with the new workflow.
I can throw a CLI message if make_rda=TRUE stating as much for now, so its not confusing for users.

I'm considering a different idea: provide some semblance of a caption/alt text (not the typical data-driven ones- a static one, without placeholders, for now). I think that would help ensure the pipeline still adds a caption and alt text object to the rda, and to the asar report, which the users can (and should) edit. That way, they'll have something to edit, vs. starting from scratch. If we do this, we'd add a caption and alt text to the template csv. Then, we'd alert the user that they should update the caption and alt text for accuracy and descriptiveness until we develop functionality to create data-driven versions. Thoughts, @Schiano-NOAA ?

Okay. This would alleviate the immediate need to handle multi-model key quantities at least. For something like retrospectives, where one function can make a bunch of different plots depending on the quantity, were you thinking of just having one "retrospectives" static captions/alt text, or a unique one for each possible quantity?

@sbreitbart-NOAA

Copy link
Copy Markdown
Collaborator

@sbreitbart-NOAA regarding our conversation yesterday about captions/alttext for retrospectives, the current way of using create_rda relies on the intermediate CSV files. If the plan is to eventually move away from those, then I think it might be better to just not implement captions/alttext for retrospective plots for right now, and update them later with the new workflow.
I can throw a CLI message if make_rda=TRUE stating as much for now, so its not confusing for users.

I'm considering a different idea: provide some semblance of a caption/alt text (not the typical data-driven ones- a static one, without placeholders, for now). I think that would help ensure the pipeline still adds a caption and alt text object to the rda, and to the asar report, which the users can (and should) edit. That way, they'll have something to edit, vs. starting from scratch. If we do this, we'd add a caption and alt text to the template csv. Then, we'd alert the user that they should update the caption and alt text for accuracy and descriptiveness until we develop functionality to create data-driven versions. Thoughts, @Schiano-NOAA ?

Okay. This would alleviate the immediate need to handle multi-model key quantities at least. For something like retrospectives, where one function can make a bunch of different plots depending on the quantity, were you thinking of just having one "retrospectives" static captions/alt text, or a unique one for each possible quantity?

Ultimately, the captions and alt text will need to be differentiated in some way, between plots, as they're describing different plots. However, for now, I think it's alright to export identical captions/alt text if we're signalling that the underlying architecture is still "under construction".

@Schiano-NOAA

Copy link
Copy Markdown
Collaborator

Tuning in: I think that could be fine for an intermediate but I do think we will need to have some type of data-driven caption and alt text. I think it's actually a really important and defining part for stockplotr. The issue with pushing this to later is that we would need to keep a detailed list of what doesn't have it yet and what needs to be changed along with having to go back and do it for whatever we want. I don't think we should halt progress for this, but it will need to be done sooner rather than later so any new plots will be able to make the same approach.

Admittedly, I think this is easier of a thing to see in action than describing so lmk if I am understanding incorrectly.

@JZahner1

Copy link
Copy Markdown
Collaborator Author

@Schiano-NOAA I mostly agree. I think that, since this is the first plot that is specifically multi-model, its a good test case for the new caption alt-text workflow. Merging it now would make it available for thorough testing within the new workflow whenever that is implemented. I'm thinking about what other plots would explicitly require complex captions/alt-text like this by default, and Im struggling to come up with additional examples. Other plots that are reliant are multiple models (like likelihood profile plots), wouldn't require the same level of data to write a descriptive captions/alt-text.

@Schiano-NOAA

Copy link
Copy Markdown
Collaborator

Ah okay I see. I agree this should be merged once ready and the workflow be worked out in another PR

@Schiano-NOAA

Copy link
Copy Markdown
Collaborator

Also I am currently reviewing the PR and should have an approval or edits soon

Comment thread R/plot_retrospective.R Resolved
Comment thread R/plot_retrospective.R Resolved
Comment thread R/plot_retrospective.R Resolved
Comment thread R/plot_retrospective.R Resolved
Comment thread R/plot_retrospective.R Resolved

@Schiano-NOAA Schiano-NOAA left a comment •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple changes to make but I think the plots look good. I am not entirely sure what these plots usually look like so I cannot verify things.

Is this expected for the first example?

image

The other 2 look like this for me:

image

Comment thread R/plot_retrospective.R Resolved
@Schiano-NOAA

Copy link
Copy Markdown
Collaborator

Note: I don't think this worked for the Report.sso example_data in the package

image

However, I don't think we should worry about it since we are deprecating that anyway.

@JZahner1

Copy link
Copy Markdown
Collaborator Author

A couple changes to make but I think the plots look good. I am not entirely sure what these plots usually look like so I cannot verify things.

Is this expected for the first example?

image

This is what I would expect behavior wise if only a single model is present in the data (as is the case for both ss3_simple and example_data. I will add a check and alert message to the function in the case that only a single model is detected.

@JZahner1

Copy link
Copy Markdown
Collaborator Author

@Schiano-NOAA I think this is good to go now

@Schiano-NOAA
Schiano-NOAA merged commit ea137a2 into nmfs-ost:main Nov 18, 2026
6 checks passed
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.

4 participants