Repository navigation
plot_landings() and plot_discards(): predicted as lines with ribbons, observed as points,… - #511
Conversation
|
Here's the new behavior to deal with #507 library(stockplotr)
dat <- stockplotr::vermilion_snapper
# 1. Default: predicted landings as lines with 95% ribbons, observed as points,
# all fleets on one panel colored by fleet
plot_landings(dat, interactive = FALSE)# 2. One panel per fleet, with 80% intervals instead of 95%
plot_landings(dat, facet = "fleet", interval = 0.8, interactive = FALSE)# 3. Observed landings by fleet as side-by-side bars for each year
plot_landings(dat, geom = "bar", interactive = FALSE)# 4. The same bars stacked, like r4ss::SSplotCatch()
plot_landings(dat, geom = "bar", position = "stack", interactive = FALSE)# 5. The 0.1% rule: vermilion's observed and predicted landings differ by about
# 1.4%, so the fit is shown at the default tolerance = 0.001. With a looser
# tolerance they count as matching: observed landings are drawn as lines,
# with a message.
plot_landings(dat, tolerance = 0.05, interactive = FALSE)
#> ℹ The observed and predicted landings differ by less than `tolerance` (5% of the largest observed landings); plotting the observed landings only.
#> Ignoring unknown labels:
#> • linetype : "Fleet"
#> • shape : "Fleet"Created on 2026-11-17 with reprex v2.1.1 |
|
@sbreitbart-NOAA @Schiano-NOAA this fix ready for review |
Drop checks that retest index_observed_interval() or ggplot2 internals and the argument-validation errors.
|
These plots are beautiful. Should this new setup apply to other plots using the |
|
@sbreitbart-NOAA thanks! Happy to do that here, or in another PR |
@ericward-noaa please put the changes in this PR and change the PR title to reflect those changes. Thanks! |
|
@sbreitbart-NOAA @Schiano-NOAA and tagging @iantaylor-NOAA Something to get feedback on: I think applying these to the index plots in plot_index is probably the trickiest. Right now, this PR has ribbons on landings, which represents the uncertainty around the estimate. But plot_index() shows vertical lines on observed points (how uncertain each point is -- this is observation error, Line 8 in c792a6f |
|
Yeah on second thought I think this wouldn't apply to the plot_index, but I think it is for plot_discard |
…ngs(): geom: “line”, “bar” or “point”. predicted = TRUE. interval = 0.95. tolerance = 0.001. facet = "fleet" now gives one panel per fleet. - helpers out of plot_landings.R into a new file, R/utils_plot_fit.R - new test-plot_discard.R - example_data has no ribbons, because its discard uncertainty is labeled std
|
@Schiano-NOAA @sbreitbart-NOAA Ok, I think this is ready - changed applied to plot_discards() too |
|
@ericward-noaa awesome! Thank you |
|
These changes look great. Much appreciated improvement thanks! |





… bar option
What is the feature?
How have you implemented the solution?
Does the PR impact any other area of the project, maybe another repo?
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.