I want to adjust this plot to avoid the overlapping of the vertical lines and connect all the points with the same color (see graph below).
code:
library(ggplot2)
dat=read.csv("data.csv",header=T)
p<-ggplot(dat, aes(x=population, y=resp, group=population,color=cov)) +
geom_pointrange(aes(ymin=resp-sd, ymax=resp+sd))
Data
resp cov population sd
42.07 X1 A 0.33
41.92 X1 B 0.54
42.2 X1 C 0.25
41.92 X1 D 1.15
41.98 X1 E 1.35
42.5 X1 F 0.51
42.85 X1 G 0.35
38.37 X2 A 0.13
.....