I am trying to design a time to event plot in this way:
The data and the code that I have been working is the following:
structure(list(type = c("dynamic", "dynamic", "dynamic", "dynamic", "dynamic", "dynamic", "dynamic", "dynamic", "dynamic"), term = c("ATT(-4)", "ATT(-3)", "ATT(-2)", "ATT(-1)", "ATT(0)", "ATT(1)", "ATT(2)", "ATT(3)", "ATT(4)"), event.time = c(-4, -3, -2, -1, 0, 1, 2, 3, 4), estimate = c(0.26515256993999, 0.151872124263966, 0.0869620743535941, 0.511898495150082, 1.70892342183257, 1.47487464226574, 1.27266126343054, 1.41148383616974, 2.09672811604038), std.error = c(0.165251036032427, 0.125780865480357, 0.139673647128451, 0.0843033105456399, 0.132559563887908, 0.153858075990952, 0.165464288658923, 0.226006579280847, 0.291119261169366), conf.low = c(-0.0587335090914985, -0.09465384202181, -0.186793243607526, 0.346667042703132, 1.44911145080594, 1.17331835459285, 0.948357216931508, 0.968519080510181, 1.52614484894251), conf.high = c(0.589038648971479, 0.398398090549743, 0.360717392314714, 0.677129947597032, 1.96873539285921, 1.77643092993863, 1.59696530992956, 1.8544485918293, 2.66731138313825), point.conf.low = c(-0.0587335090914985, -0.09465384202181, -0.186793243607526, 0.346667042703132, 1.44911145080594, 1.17331835459285, 0.948357216931508, 0.968519080510181, 1.52614484894251), point.conf.high = c(0.589038648971479, 0.398398090549743, 0.360717392314714, 0.677129947597032, 1.96873539285921, 1.77643092993863, 1.59696530992956, 1.8544485918293, 2.66731138313825), prepost = c("pre", "pre", "pre", "pre", "post", "post", "post", "post", "post")), class = "data.frame", row.names = c(NA, -9L))grafica<-B|>ggplot(aes(x=event.time,y=estimate))+ geom_point(position=position_dodge(w=0.25))+ geom_smooth(method="loess",level=0.95,linetype=2,size=0.5,span=0.8,alpha=0.1)+ geom_errorbar(aes(ymin=conf.low,ymax=conf.high,width=0.1,color=prepost),position=position_dodge(w=0.25))+ scale_color_manual("Time",values=colores[c(4,1)])+theme_classic()+ geom_hline(yintercept = 0,linetype = "longdash" )+geom_vline(xintercept = 0 )+ scale_x_discrete(name ="event time", limits=c(-4,-3,-2,-1,0,1,2,3,4))+ # scale_color_manual("Gender",values = colores[c(4,1)])+ labs(title= "Plot")+ ylab("ylab")+ xlab("Time to event")grafica
But is not precisely what I am looking for. I would like to connect the points and create the band in order to see something similar to the provided graph.