I built a ggplot, on the x axis I reported the dates and on the y values with the following code:
ggplot()
geom_line(aes(x=date,y=stat),color='blue',)
geom_line(aes(x=date,y=fit),color='red',lty=5)
ylab('Values') xlab('date')
scale_x_date(date_breaks = "week", date_labels = "%d %b %Y")
theme_classic()
theme(axis.text.x = element_text(angle = 90, vjust = 0.5,hjust=1))
I would like to add labels in some precise points of the graph, how can i do it? I would like to choose the possession within the graph and the writing
CodePudding user response:
You can use annotate().
You can have a look - https://ggplot2.tidyverse.org/reference/annotate.html
and https://ggplot2-book.org/annotations.html
Please add a min rep example for further details.
