For the following dataset I am trying to mark the SD over the ggplot and highlight it.
ID    S1      S2
1   21.09542  71.06014
2   21.09564  71.06064
2   21.09619  71.06128
2   21.09636  71.06242
2   21.09667  71.06564
2   21.09483  71.06619
2   21.09483  71.06619
1   21.09264  71.06633
3   21.08986  71.06678
3   21.08925  71.06653
3   21.08925  71.06653
1   21.08925  71.06653
and so on...
This is my path from the dataset link I tried this command for plotting the SD over the ggplot:
#Data frame with mean and SD
df4 <- Data %>% group_by(ID) %>% mutate(SD1 = sd(s1)) %>% mutate(SD2 = sd(s2)) %>% mutate(mean_s1 = mean(s1)) %>% mutate(mean_s2 = mean(s2))
I have made a path via geom_path(), now I want to highlight the SD over this path. Something like this link, where the highlighted path is showing me the SD from the path.
plt <- ggplot(df4, aes(x = s1, y = s2, colour = ID), pch = 17) +geom_point()
plt + geom_path(data = rbind(cbind(tail(Data.sel, -1), grp = 1:(nrow(Data.sel)-1)),  
        cbind(head(Data.sel, -1), grp = 2:nrow(Data.sel)-1)),
        aes(group = interaction(grp)), arrow= arrow(type = "closed", angle = 12), colour="grey") +
geom_errorbar(aes(x=Latitude, ymin=Longitude-std.latitude, ymax=Longitude+std.longitude))
