Skip to content

Violin plots with too few observations are broken #3314

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
paleolimbot opened this issue May 8, 2019 · 4 comments
Closed

Violin plots with too few observations are broken #3314

paleolimbot opened this issue May 8, 2019 · 4 comments
Milestone

Comments

@paleolimbot
Copy link
Member

The revdep checks (#3303) identified an issue where geom_violin() plots with too few observations now fail. In 3.1.1, these plots were rendered with no geometry and no warning. This differs from the behaviour of geom_density(), which issues a warning before dropping a group with too few observations.

library(ggplot2)
ggplot(data.frame(y = 1), aes(factor(1), y = y)) + geom_violin()
#> Warning in max(data$density): no non-missing arguments to max; returning -
#> Inf
#> Error: Elements must equal the number of rows or 1
@paleolimbot paleolimbot added this to the ggplot2 3.2.0 milestone May 8, 2019
@clauswilke
Copy link
Member

This is what I get with #3320. Is this acceptable behavior?

library(ggplot2)
ggplot(data.frame(y = 1), aes(factor(1), y = y)) + geom_violin()
#> Warning in max(data$density): no non-missing arguments to max; returning -
#> Inf

Created on 2019-05-08 by the reprex package (v0.2.1)

@paleolimbot
Copy link
Member Author

I can confirm that this was the behaviour in 3.1.1

clauswilke added a commit to wilkelab/ggplot2_archive that referenced this issue May 8, 2019
@clauswilke clauswilke mentioned this issue May 10, 2019
17 tasks
@tfettrow
Copy link

tfettrow commented Aug 4, 2019

I am using ggplot2 3.2.0 and am experiencing this issue again. It is not clear form the above comments whether the function just requires more data to plot properly. Any thoughts?

@lock
Copy link

lock bot commented Jan 31, 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 Jan 31, 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