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 expects some binning arguments (e.g., bins) but not others (e.g., breaks) #2214

Closed
jwdink opened this issue Jul 19, 2017 · 1 comment
Labels
feature a feature request or enhancement layers 📈

Comments

@jwdink
Copy link

jwdink commented Jul 19, 2017

I'd like to pass "breaks" to stat_summary_bin, but this doesn't seem to work as expected, despite other binning arguments working.

set.seed(32)
library("ggplot2")
df <- data.frame(x = rnorm(1000), y = rnorm(1000))

ggplot(df, aes(x = x, y = y)) + stat_summary_bin(breaks = seq(-3, 3, by = 0.5))
#> Warning: Ignoring unknown parameters: breaks
#> No summary function supplied, defaulting to `mean_se()
#> Warning: Removed 1 rows containing missing values (geom_pointrange).

ggplot(df, aes(x = x, y = y)) + stat_summary_bin(bins = 12)
#> No summary function supplied, defaulting to `mean_se()

@karawoo karawoo added feature a feature request or enhancement layers 📈 labels Jul 24, 2017
@karawoo
Copy link
Member

karawoo commented Jul 24, 2017

StatSummaryBin takes bins and binwidth arguments, but not breaks. A workaround could be:

ggplot(df, aes(x = cut_width(x, 0.5, center = 0), y = y)) +
  stat_summary_bin()

karawoo added a commit to karawoo/ggplot2 that referenced this issue Jul 27, 2017
@lock lock bot locked as resolved and limited conversation to collaborators Jun 18, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature a feature request or enhancement layers 📈
Projects
None yet
Development

No branches or pull requests

2 participants