How can I use geom_smooth() function to highlight my graph. . But I couldn't get the solution for this.
This is my dataset as:
A1 A2 A3
21.09542 71.06014 0
21.09564 71.06064 1
21.09619 71.06128 1
21.09636 71.06242 2
21.09667 71.06564 0
21.09483 71.06619 3
.....
I have calculated the variance for the A1 and A2 and plotted via ggplot. A piece of code is given below:
var.A1 = var(A1)
var.A2 = var(A2)
plt <- ggplot(df4, aes(x = A1, y = A2, colour = A3), pch = 17) +geom_point()
plt + geom_errorbar(aes(x=A1,y=A2, ymin=A2-var.A2, ymax=A2+var.A2),width=0.001)+
geom_errorbarh(aes(xmin=A1-var.A1,xmax=A1+var.A1),height=0.001)