Quantcast
Channel: Active questions tagged r - Stack Overflow
Viewing all articles
Browse latest Browse all 201839

How to label the last point in a line chart

$
0
0

I am using the code below to generate the chart below it. I want to add a label that shows the value of the last data point in the chart. Thank you.

min<-as.Date("2003-01-01")
add_columns_data %>%
  ggplot(aes(Index,MTM))+
  geom_line(col="steelblue", size=1.5)+
  theme(axis.text.x=element_text(angle =- 90, vjust = 0.5),
        plot.title = element_text(hjust=0.5)) +
  scale_x_date(limits = c(min, NA), date_breaks = "6 months", expand=c(0,0))+
  scale_y_continuous(breaks=seq(-4,4,0.5))+
  labs(y="Percentage (%)",
       x="",
       title= "Monetary Tightness Measure")+
  geom_hline(yintercept = 0, color = "black")

enter image description here


Viewing all articles
Browse latest Browse all 201839

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>