Skip to content

Violin plots with too few observations are broken #3314

Closed
@paleolimbot

Description

@paleolimbot

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions