I am trying to display error bars using geom_errorbar() after using coord_trans() to plot the x-data in semilog scale. Somehow geom_errorbar() does not work but geom_linerange() does.
My code is as follows:
data <- data.frame(x=c(1, 10, 25, 50, 100, 500, 1000),
y=c(0.3990093, 0.6062332, 0.7663158, 0.9779979, 1.6546543, 8.2825181, 18.2218369),
std=c(0.09528301, 0.03620494, 0.01246995, 0.06584974, 0.15254007, 0.29668775, 0.86524986))
data %>%
ggplot()+
geom_point(aes(x, y), colour="blue")+
coord_trans(x = "log10")+
geom_smooth(aes(x, y), method = "lm", formula = y ~ x, lwd=0.75, se = F, colour="lightblue")+
#geom_errorbar(aes(x=x, ymin=y-std, ymax=y+std), colour="black")
geom_linerange(aes(x=x, ymin=y-std, ymax=y+std), colour="black")
However, geom_linerange() only displays a vertical bar and I would like an horizontal bar on top of the vertical bar, as geom_errorbar() usually allows to display.
Does anyone know how to do that? Thank you in advance!
Estelle

