Skip to content

Fix warning regression in geom_dotplot() #5277

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

Merged
merged 1 commit into from
Apr 21, 2023

Conversation

teunbrand
Copy link
Collaborator

This PR aims to fix a regression from #5267.

Briefly, geom_dotplot()/stat_bindot() started emitting warnings when these functions shouldn't. For example:

library(ggplot2) # current main branch

dat <- data_frame(x = rnorm(20), g = rep(LETTERS[1:2], 10))

ggplot(dat, aes(x, fill = g)) + 
  geom_dotplot(binwidth = .4, alpha = .4, binpositions = "all")
#> Warning: The following aesthetics were dropped during statistical transformation: bin,
#> bincenter
#> ℹ This can happen when ggplot fails to infer the correct grouping structure in
#>   the data.
#> ℹ Did you forget to specify a `group` aesthetic or to convert a numerical
#>   variable into a factor?

Created on 2023-04-19 with reprex v2.0.2

This PR fixes that spurious warning by adding bin and bincenter to the dropped_aes field.

Copy link
Member

@thomasp85 thomasp85 left a comment

Choose a reason for hiding this comment

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

LGTM

@teunbrand teunbrand merged commit a076a10 into tidyverse:main Apr 21, 2023
@teunbrand teunbrand deleted the fix_stat_bindot_warning branch April 21, 2023 16:09
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.

2 participants