I have a regression line, called "mean". X-axis is called "week"
Now, I want to draw vertical and horizontal lines, from each point of the
regression line, to x-axis and y-axis.
Here is my code:
ggplot()+
geom_linerange(data=df2,x=df2$week, ymin=0, ymax=df2$mean,
colour="#000000",size=0.1)+
geom_hline(data=df2,
yintercept=df2[trunc(df2$week),"mean"],colour="#000000",size=0.1)
I have successfully draw the vertical line, using geom_linerange.
However, the geom_hline just won't work. R just doesn't draw anything.
I don't know, if geom_hline is the function I should use. I was trying to
use geom_vline for the vertical line part, but it never worked, so I
switched back to geom_linerange, and it worked perfectly.
Thanks for any help!!
[[alternative HTML version deleted]]