Skip to content

Aligning plots: Implementation of drop = FALSE for position_dodgeΒ #3988

@char4816

Description

@char4816

As others have pointed out (#688), having a position_dodge option such as drop = FALSE would be really helpful for plots like this:

image

I know Hadley has given some helpful workaround suggestions (e.g. faceting) and has mentioned that this isn't within the scope of position_dodge but I am hoping that one more person raising the issue might help to make the change.

What's happening for some of my plots' x-categories is that there are only 2 data points (e.g. cases in Homozygous Alt in my plot), which is enough to generate a boxplot, but not a violin plot

geom_violin(alpha=0.4, position = position_dodge(width=0.9))

Because the 3rd green violin plot doesn't have a counterpart to "dodge", the violin plot is centered and therefore wider and not aligned with its corresponding boxplot which is quite sad to look at.

While faceting works to an extent:
image

It would look much cleaner for publication if I could do position = position_dodge(width=0.9), drop = FALSE)

I hope this suggestion is taken seriously and I really appreciate your help & time.

Chris

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions