[R] ggplot: connect points with line (not in order)

Brian Smith bsmith030465 at gmail.com
Sun Apr 5 15:03:20 CEST 2015


I am trying to connect points, but not in a different order than the
default value in ggplot. For example:

 xx <- sample(1:100,5)
  yy <- sample(1:100,5)

  mydat <- data.frame(xx,yy)

  ggplot(mydat,aes(xx,yy)) + geom_point() + geom_line()

I want to connect the points as they appear in mydat, and not necessarily
from the smallest value on the 'x' axis to the largest.

How can I do this?


	[[alternative HTML version deleted]]

More information about the R-help mailing list