Skip to content

grouping in geom_boxplot broken after upgrading from 3.5.2 to 3.6.1 #3496

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

Closed
ovvldc opened this issue Aug 21, 2019 · 7 comments
Closed

grouping in geom_boxplot broken after upgrading from 3.5.2 to 3.6.1 #3496

ovvldc opened this issue Aug 21, 2019 · 7 comments

Comments

@ovvldc
Copy link

ovvldc commented Aug 21, 2019

Following the advice in https://ggplot2.tidyverse.org/reference/geom_boxplot.html, I made a box plot with manually created statistics, using:

geom_boxplot( data = stats, aes(x = x, group = set, ymin = Minimum, lower = Lower_quartile, middle = Median, upper = Upper_quartile, ymax = Maximum, colour = set, fill = set), width = 0.5, stat = "identity", show.legend = FALSE ) +

This worked wonderfully until today, after I upgraded from R 3.5.2 to 3.6.1 and reinstalled and updated my packages. Now this happens:

print(graph)
Error: Can't draw more than one boxplot per group. Did you forget aes(group = ...)?

Clearly, I did not forget, and it was working fine yesterday. The input data has also not changed.

@ovvldc
Copy link
Author

ovvldc commented Aug 21, 2019

I can make both data and full script available, but this is an ongoing research project with personally identifiable data, so I cannot just post it here.

@ovvldc
Copy link
Author

ovvldc commented Aug 21, 2019

here is the input data for the box plot at least: stats.txt

@ptoche
Copy link

ptoche commented Aug 21, 2019

you should make a fully reproducible example with a dataset such as cars, and even better use reprex.

@clauswilke
Copy link
Member

This is listed as a breaking change in the 3.2.0 release notes (issue #3316).

While the plot may have worked for you, it was using code whose behavior was undefined. To fix your plot, you'll have to define a group aesthetic that has a unique value for each boxplot that should be drawn.

@ovvldc
Copy link
Author

ovvldc commented Aug 22, 2019

Problem is that the error message is very unclear and misleading, as I clearly did set a group = in the code, and the release notes also do not specify what stopped working or how the input is supposed to be given now.

@clauswilke
Copy link
Member

The error message states exactly what the problem is: "Can't draw more than one boxplot per group." You will have to assign a grouping variable that has a unique value for each boxplot you want to see drawn. If you're not sure what that means or how to achieve this, I suggest you ask over on the RStudio forums or on Stackoverflow.

@lock
Copy link

lock bot commented Feb 21, 2020

This old issue has been automatically locked. If you believe you have found a related problem, please file a new issue (with reprex) and link to this issue. https://reprex.tidyverse.org/

@lock lock bot locked and limited conversation to collaborators Feb 21, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants