I hope to make graph like this: image from a journal
My data is like:
temp<-data.frame(agecat=c("40-49","40-49","50-59","50-59","60+","60+"),
ANY=c("NO","YES","NO","YES","NO","YES"),
median=c(0.81,0.83,0.78,0.83,0.84,0.89),
up=c(1.2,1.25,1.25,1.31,1.44,1.34),
down=c(0.53,0.41,0.41,0.47,0.56,0.69))
(the HIV in graph is like ANY in my figures)
I tried the code below, it doesn't work.
ggplot(temp,aes(agecat,median,group=ANY,color=ANY,LABEL=round(median)))+geom_point()+facet_grid(~ANYPLAQ+agecat, scales="free", space="free")+geom_errorbar(aes(ymin=down,ymax=up),width=0.2)
I could only get figure like this: enter image description here
I hope the width between each column are different for within age group and between age groups.
Could someone give me some suggestions, thanks!!