I have a slighlty complex looking plot, created with ggplot2; with X axis having names of each point and Y axis having their values. I used geom_point to represent these. I have also added errorbars for each point on the plot.
Now I have superimposed a plot that uses only geom_hline with different linetypes to represent the samples in this data (it is a different data frame than the first, but shares the X and Y axis). I would like to show the deviations on these hlines and I am looking for inspiration as to how to depict the deviations on hlines.
I tried to add errorbars but then they appear as additional samples on the Xaxis, which is not ideal. Is it a feasible idea in the first place?
This is how it looks with the hlines, the errorbars showing up as extra points on X axis.
Edit: Snippet of the code if it serves as an inspiration to someone trying something similar
p <- ggplot(df_sample_dots, aes(x=Names, y=Values), show.legend = TRUE) + geom_point(size=5, aes(color=factor(Names))) +
geom_errorbar(aes(ymin=Values-dev, ymax=Values+dev), width=.2, position=position_dodge(.9), color="black")
p <- p + geom_hline(aes(yintercept=Values, linetype=Names), data=df_sample_hlines, show.legend = TRUE, color="black") +
geom_errorbar(aes(ymin=Values-dev, ymax=Values+dev), data = df_sample_hlines, color="thistle4", width=1, size=1)