[R] ggplot with arrows
    Thomas Subia 
    tg@77m @end|ng |rom y@hoo@com
       
    Fri Aug  1 16:30:37 CEST 2025
    
    
  
Consider:
x <- seq(-5,5,length.out = 100)
y <- x^2
data <- data.frame(x,y)
library(ggplot2)
ggplot(data,aes(x,y))+
  stat_function(
    fun = function(x) x^2,
    color = "blue", linewidth = 1.25
  ) +
  theme_linedraw()
I'd like to add an arrow to the ends of curve to illustrate the curve continues indefinitely in that direction,
ChatGPT suggests using geom_segment or geom_link but there has an easier way to do this.
Any suggestions would be appreciated.
	[[alternative HTML version deleted]]
    
    
More information about the R-help
mailing list