Closed
Description
I have this issue - basically the different components of the geom_errorbar have jitter being applied to them differently. I posted this on stack-exchange and someone there seemed to think it might be a bug.
library(tidyverse)
Basic data set:
df <- structure(list(
Test = c("A", "B", "C", "D", "A", "C", "D"),
mean = c(1, 100.793684, 1, 1, 51.615601, 1, 2.456456),
sd = c(1, 2.045985, 1, 1, 4.790053, 1, 4.250668),
lower = c(2, 102.839669, 2, 2, 56.405654, 2, 6.707124),
upper = c(0, 98.747699, 0, 0, 46.825548, 0, -1.79421)),
row.names = c(NA, -7L), class = c("tbl_df", "tbl", "data.frame"))
Now the code I am using:
subplot <- ggplot(df, aes(x = Test, y = mean)) +
geom_point(aes(x= Test, y = mean),
position = position_jitter(width = 0.2, height = 0.2))+
geom_errorbar(aes(ymin = lower, ymax = upper),
width = 0.1,
position = position_jitter(width = 0.2, height = 0.2))
subplot
Thanks.