Skip to content

overlapping boxes with geom_boxplot(varwidth=TRUE) #2143

Closed
@mcol

Description

@mcol

When I try to produce boxplots with colours depending on a categorical variable, these appear overlapping if varwidth is set to TRUE (which is what I'd like to use).

Here's an example:

ggplot(data=iris, aes(Species, Sepal.Length)) + 
   geom_boxplot(aes(colour=Sepal.Width < 3.2), varwidth=TRUE)

This raises the following warning: "position_dodge requires non-overlapping x intervals"

However, the boxes don't overlap (and no warning is raised) if varwidth is not specified.

ggplot(data=iris, aes(Species, Sepal.Length)) + 
   geom_boxplot(aes(colour=Sepal.Width < 3.2))

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugan unexpected problem or unintended behaviorlayers 📈

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions