Skip to content

Warning when using facet_grid() with ordered factors #6479

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
lgaborini opened this issue May 26, 2025 · 1 comment
Open

Warning when using facet_grid() with ordered factors #6479

lgaborini opened this issue May 26, 2025 · 1 comment
Labels
messages requests for improvements to error, warning, or feedback messages

Comments

@lgaborini
Copy link

A bit of a niche issue, the plotting works fine, and the factor ordering is also retained, but I signal it nevertheless.

library(ggplot2)

df <- mtcars |>
  dplyr::mutate(
    dplyr::across(c(gear, carb), ordered)
  )

df |>
  ggplot(aes(mpg, wt)) +
  geom_point() +
  facet_grid(
    vars(gear), vars(carb),
    margins = TRUE
  )
#> Warning: Combining variables of class <ordered> and <factor> was deprecated in ggplot2
#> 3.4.0.
#> ℹ Please ensure your variables are compatible before plotting (location:
#>   `reshape_add_margins()`)
#> This warning is displayed once every 8 hours.
#> Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
#> generated.
#> Warning: Combining variables of class <factor> and <ordered> was deprecated in ggplot2
#> 3.4.0.
#> ℹ Please ensure your variables are compatible before plotting (location:
#>   `reshape_add_margins()`)
#> This warning is displayed once every 8 hours.
#> Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
#> generated.

Created on 2025-05-26 with reprex v2.1.1

@teunbrand teunbrand added the messages requests for improvements to error, warning, or feedback messages label May 28, 2025
@teunbrand
Copy link
Collaborator

And so the saga of #5109 and #5666 continues...
Thanks for the report nonetheless!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
messages requests for improvements to error, warning, or feedback messages
Projects
None yet
Development

No branches or pull requests

2 participants