Skip to content

Fix warning regression in geom_dotplot() - #5277

Merged
teunbrand merged 1 commit into
tidyverse:mainfrom
teunbrand:fix_stat_bindot_warning
Apr 21, 2023
Merged

teunbrand merged 1 commit into
tidyverse:mainfrom
teunbrand:fix_stat_bindot_warning

Conversation

@teunbrand

Copy link
Copy Markdown
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.

@thomasp85 thomasp85 left a comment

Copy link
Copy Markdown
Member

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