Skip to content
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

stat_summary_bin(width) of preferred over default width #5970

Merged
merged 4 commits into from
Aug 28, 2024

Conversation

teunbrand
Copy link
Collaborator

@teunbrand teunbrand commented Jul 3, 2024

This PR aims to fix #4647.

Briefly, it adds $compute_group(..., width), which is preferred over the computed bin width when provided by the user.

Reprex from issue:

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

ggplot(iris, aes(x = Sepal.Length, y = Sepal.Width, color = Species)) +
  stat_summary_bin(geom = "errorbar", width = 2)
#> No summary function supplied, defaulting to `mean_se()`
#> No summary function supplied, defaulting to `mean_se()`
#> No summary function supplied, defaulting to `mean_se()`

Created on 2024-07-03 with reprex v2.1.0

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.

Just making sure I understand this fix. This means that the width reported by stat_summary_bin() no longer corresponds to the bin width if the user sets a width parameter?

@teunbrand
Copy link
Collaborator Author

Yes, that is right. Do you think that the binwidth should be exposed in a computed variable somewhere?

@teunbrand teunbrand merged commit c32fea1 into tidyverse:main Aug 28, 2024
13 checks passed
@teunbrand teunbrand deleted the summy_bin_width branch August 28, 2024 07:55
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.

Width argument to geom_errorbar not passed on when using stat_summary_bin
2 participants