add tag at the end of the line ggplot

I am trying to add the name of the column at the end of lines in ggplot. Neither geom_text or geom_label worked.

df %>% 
  filter(played < 39) %>% #filtering dataset for the season that was played 38 games
  filter(place==1) %>% # analysing the champions
  #create graph to show the champions 
  
  ggplot()+
  aes(x=season) +
  geom_line(aes(y=points), color = "blue") + 
  geom_line(aes(y=goals), color="red") +
  geom_line(aes(y=won), color = "purple") +
  geom_line(aes(y=loss), color = "orange") +
  geom_line(aes(y=draw)) +
  
  geom_label() +
    
  labs( title = "Brasileirão", 
        subtitle = "2006 - 2024"
    
  ) +
  theme(
    
  )

Screenshot 2025-03-12 at 9.53.20 PM

I think the easiest way would be to reshape your data into a long format. That way, you would only need one call to geom_line() instead of 5, and geom_label() would work. Look into the tidyr::pivot_longer() function to reshape your data.
If you need more specific help, please try to provide a proper reproducible example (Reprex) for your problem.

2 Likes