Skip to content

Add preserve argument to position_jitterdodge() #6584

@luckybarrel54-sudo

Description

@luckybarrel54-sudo

In situations when I want to plot stacked box plot with scatter plot of individual data points on top of it, but the dataset contains some missing data, while I can use the position_dodge(preserve = "single") argument to ensure the bars are not combined, it is not possible to do so with the scatter plot of data points, since position_jitterdodge() does not have the "preserve" argument.

I would like to be able to add the preserve argument to position_jitterdodge()

ggplot(data, aes(x = Var1, y = Var2, fill = Var3) +
stat_summary(geom = "bar", fun = "mean", show.legend = T, position = position_dodge(preserve = "single")) +
stat_summary(geom = "errorbar", fun.data = "mean_sdl", fun.args = list(mult = 1),
width = 0.3, position = position_dodge(width = 1, preserve = "single")) +
geom_point(show.legend = F, position = position_jitterdodge(jitter.width = 0.3, dodge.width = 1, preserve = "single"))

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions