Hi,
You could add arrows with geom_segment; however if you want even
spacing along the path it might get tricky,
library(ggplot2)
d <- data.frame(x=seq(0, 10, length=100),
y=sin(seq(0, 10, length=100)))
N <- 10
dN <- 2
ind <- seq(1,nrow(d),by=N)
ind <- ind[-c(1,length(ind))]
d3 <- data.frame(xstart = d$x[ind],
xend = d$x[ind+2],
ystart = d$y[ind],
yend = d$y[ind+2])
ggplot(d)+
geom_path(aes(x,y)) +
geom_segment(data=d3, aes(xstart,ystart,xend=xend,yend=yend), arrow=arrow())
HTH,
baptiste
On 23 February 2011 02:00, Malcolm Ryan <malcolmr at cse.unsw.edu.au>
wrote:> I'm doing a path plot with ggplot2, the result is looking very nice,
but I want to give some indication of which direction the lines are going. I
thought of using colour gradients, but it doesn't look right. What would be
ideal is a line type that indicated direction, something like
">>>>>>>". Is there any way to achieve this? Or
can anyone suggest another way of representing this information?
>
> Malcolm
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>