Skip to content

Scales with no matching data throw warnings #5909

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

Closed
wants to merge 3 commits into from

Conversation

teunbrand
Copy link
Collaborator

@teunbrand teunbrand commented May 27, 2024

This PR aims to fix #3743.

Briefly, a warning is thrown when a scale was declared, but none of the data has the relevant aesthetic.

I had to touch the build method to coordinate this warning, but if extensions don't update they should skip the warning, so it should be safe.

Reprex from issue:

devtools::load_all("~/packages/ggplot2")
#> ℹ Loading ggplot2

ggplot(iris, aes(x = Species, y = Sepal.Length, fill = Species)) +
  geom_boxplot() +
  scale_colour_brewer(
    name = 'Dude which plant',
    palette = 'Set2'
  )
#> Warning in scale_colour_brewer(name = "Dude which plant", palette = "Set2"):
#> Scale for colour aesthetic was provided but has no matching data to map.

Created on 2024-05-27 with reprex v2.1.0

@teunbrand
Copy link
Collaborator Author

I'm closing this, there are too many spurious cases where this warning is thrown

@teunbrand teunbrand closed this May 27, 2024
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.

Feature request: warning for fill/colour mismatch between aes() and scale...()
1 participant