Document that scale_{x/y}_binned() does not make x/y a factor
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 65/100
- Issue type
- Documentation
- Clarity
- Mostly clear
- Activity status
- Quiet
- Tech stack
- r
- Domain
- data-visualization, documentation
Research direction
Start with the documentation for scale_x_binned() and scale_y_binned(), then review the existing guidance around grouping and binned variables. Done means explaining that these scales remain continuous and adding a correct boxplot example using cut() or cut_interval(), cut_number(), or cut_width().
Written by the indexing model from the issue text.
Description
I mistakenly thought the following code would produce multiple vertical boxplots, grouped by the binned wt variable. Instead it produces a single vertical boxplot (with a warning that the "orientation is not uniquely specified"):
library(ggplot2)
mtcars |>
ggplot(aes(wt, mpg)) +
geom_boxplot() +
scale_x_binned()
Another user had the same mistaken impression: https://github.com/tidyverse/ggplot2/issues/4211. In that issue, a ggplot2 author said "Since x is continuous, even after it's binned, it cannot be a grouping variable."
I also asked Claude Opus 4.6 about this, and it had the same misunderstanding as I did, incorrectly saying "geom_boxplot() recognizes the binned scale and automatically creates one boxplot per bin."
I request that the documentation mention that when you use scale_x_binned(), the x variable remains a continuous variable -- it is not converted to a factor as I had thought. Likewise of course for scale_y_binned().
I think it would also be helpful if the documentation mentioned a correct way to achieve the binned boxplot that I wanted, using either base R's cut() or ggplot2's cut_interval()/cut_number()/cut_width(). E.g.,
mtcars |>
ggplot(aes(cut(wt, 3), mpg)) +
geom_boxplot()
- Dominant language
- R
- Stars
- 7k
- Forks
- 2.1k
- Avg merge
- 59m
- Merged PRs (30d)
- 2
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from tidyverse/ggplot2
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
internals :mag_right:
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
-
themes :dancer:
Difficulty 2/5 1-3 hours Newbie friendliness 64/100
-
documentation themes :dancer:
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
-
positions :1st_place_medal:
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
All issues in tidyverse/ggplot2
Similar issues
-
documentation pkg infrastructure
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
epiverse-trace/epiparameter#511 ·
-
function:write_dwc
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
r-lib/pkgdepends#485 · 3 comments ·
-
Difficulty 1/5 Under an hour Newbie friendliness 92/100
-
beginners blocker
Difficulty 2/5 1-3 hours Newbie friendliness 78/100