I am struggling with the following issue and would really appreciate your help.
I have the following data (this is just a random example for simplification)
x<- c('left', 'left', 'left', 'right', 'right', 'right')
y<- c (0.5, 0.3, 0.2, 0.5, 0.7, 0.2)
conf<- c(1.5, 1.7, 3, 2, 3, 1)
df <-data.frame(x,y,conf)
I want to do the following plot.
library(ggplot2)
ggplot(df, aes(x=x, y=y))+geom_point()+coord_flip()
This generates the following image see photo here. But each of my points (y) has a also certain confidence associated with them (variable conf), which I would like to plot as confidence values on another x axis (that would go on the right hand side in this case and the confidence values would be vertical lines). How do I add this second x axis on the right side of the plot, so that it is numerical and that it plots my values as confidence intervals?
Thanks a lot for your help.