Skip to content

[Fix]: remove grouping override#282

Open
Schiano-NOAA wants to merge 2 commits into
mainfrom
hotfix-group-override
Open

[Fix]: remove grouping override#282
Schiano-NOAA wants to merge 2 commits into
mainfrom
hotfix-group-override

Conversation

@Schiano-NOAA

Copy link
Copy Markdown
Collaborator

I am removing the code that overrides group when user input something that was not in the index variables. The function check_grouping() (internal) only matches a certain number of potential grouping variables so it will cause a plot to plot incorrectly when some other id variable is present. This removes this issue, but the error still persists unless the user puts the explicit column name for grouping in the group argument.

For example, group = "fleet" will be recognizes whether a user inputs the column as an argument or not. The column name "retrospective" will not be automatically detected as an index variable in group, so the plot will look off and not contain the information in the legend. But if the user explicitly states group = "retrospective" in the argument for the plot, it will plot correctly.

@github-actions

Copy link
Copy Markdown
Contributor

New version checklist

  • Package version in DESCRIPTION has been updated
  • Release notes have been drafted/published
  • Cheatsheet content has been updated (if applicable)
  • Cheatsheet version has been updated

@Schiano-NOAA

Copy link
Copy Markdown
Collaborator Author

@kellijohnson-NOAA could you check this branch solves your issue?

@Schiano-NOAA Schiano-NOAA self-assigned this Jun 24, 2026
@Schiano-NOAA Schiano-NOAA added the bug Something isn't working label Jun 24, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Code Metrics Report

Coverage Code to Test Ratio Test Execution Time
67.2% 1:0.1 7m22s

Code coverage of files in pull request scope (63.7%)

Files Coverage
R/process_data.R 63.7%

Reported by octocov

@kellijohnson-NOAA

Copy link
Copy Markdown
Collaborator

❌ Did not work because it changed my column name to have an upper case first letter. So, I tried changing to "Retrospective_peel" but that did not work either. I got the same "Ignoring unknown labels" message

r$> stockplotr::plot_spawning_biomass(
      test,
      group = "retrospective_peel"
    )
Ignoring unknown labels:
* linetype : "Retrospective_peel"
* shape : "Retrospective_peel"
Ignoring unknown labels:
* linetype : "Retrospective_peel"
* shape : "Retrospective_peel"
Error in `ggplot2::geom_ribbon()`:
! Problem while converting geom to grob.
i Error occurred in the 1st layer.
Caused by error in `draw_group()`:
! Unable to check the capabilities of the windows device.
Run `rlang::last_trace()` to see where the error occurred.

r$> rlang::last_trace()
<error/rlang_error>
Error in `ggplot2::geom_ribbon()`:
! Problem while converting geom to grob.
i Error occurred in the 1st layer.
Caused by error in `draw_group()`:
! Unable to check the capabilities of the windows device.
---
Backtrace:
     x
  1. +-base (local) `<fn>`(x)
  2. \-ggplot2 (local) `print.ggplot2::ggplot`(x)
  3.   +-ggplot2::ggplot_gtable(data)
  4.   \-ggplot2 (local) `ggplot_gtable.ggplot2::ggplot_built`(data)
  5.     \-ggplot2:::by_layer(...)
  6.       +-rlang::try_fetch(...)
  7.       | +-base::tryCatch(...)
  8.       | | \-base (local) tryCatchList(expr, classes, parentenv, handlers)
  9.       | |   \-base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]])
 10.       | |     \-base (local) doTryCatch(return(expr), name, parentenv, handler)
 11.       | \-base::withCallingHandlers(...)
 12.       \-ggplot2 (local) f(l = layers[[i]], d = data[[i]])
 13.         \-l$draw_geom(d, layout)
 14.           \-ggplot2 (local) draw_geom(..., self = self)
 15.             \-self$geom$draw_layer(...)
 16.               \-ggplot2 (local) draw_layer(..., self = self)
 17.                 \-base::lapply(...)
 18.                   \-ggplot2 (local) FUN(X[[i]], ...)
 19.                     +-rlang::inject(self$draw_panel(data, panel_params, coord, !!!params))
 20.                     \-self$draw_panel(...)
 21.                       \-ggplot2 (local) draw_panel(..., self = self)
 22.                         \-base::lapply(...)
 23.                           \-ggplot2 (local) FUN(X[[i]], ...)
 24.                             \-self$draw_group(group, panel_params, coord, ...)
 25.                               \-ggplot2 (local) draw_group(..., self = self)

@Schiano-NOAA

Copy link
Copy Markdown
Collaborator Author

@kellijohnson-NOAA Huh interesting! I'll test more and adjust tomorrow. Thanks for checking it for me!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants