I am trying to change the widht of the geom_errorbar() 'whiskers' of the following ggplot.
In my eyes it seems like a bug. The usual width = x
specification for the errorbars does not work here. it interferes with the width = x
specification of the position = "dodge
argument. Is there any way i can specify that width = x
is only for geom_errorbars?
library(tidyverse)
data <- as_tibble(rbind(c("out", 14, 2.3,T),
c("in", 15, 2.7,T),
c("far", 18, 4,T),
c("out", 14, 2.3, F),
c("in", 17, 2.3, F),
c("far", 13, 2.3, F)
)
)
colnames(data) <- c("position", "mean", "se", "dead")
data$mean <- as.numeric(as.character(data$mean))
data$se <- as.numeric(as.character(data$se))
data
ggplot(data = data, aes(x = position, y = mean, fill = dead)) +
geom_errorbar(aes(ymin = mean - se, ymax = mean + se),
stat = "identity",
position = "dodge",
width = 3)+ # its about this line !
geom_bar(stat = "identity",
position = "dodge")
This is the plot given out by the code above:
the errorbars are all over the place. without the width = x
specification they are where they should be, but i would like them to be smaller !