Reputation: 125
I have a sigmoid curve and want to annotate the 50% using ggplot2 as shown in the image below in dotted red. I know how to add a line to the graph but that goes all the way to the top. I want the lines coming from x and y-axis and reach and stop at that point.
Upvotes: 1
Views: 352
Reputation: 1530
You can use geom_segment
.
ggplot(iris, aes(x = Sepal.Length, y = Sepal.Width)) +
geom_point() +
geom_segment(x = 0, xend = 6, y = 3, yend = 3, linetype = 2, color = 'red3') +
geom_segment(x = 6, xend = 6, y = 0, yend = 3, linetype = 2, color = 'red3')
Upvotes: 1