Sunday 15 April 2012

r - Plotting lines between coordinates using ggplot2 -


I am trying to plot the connecting lines for different sets of coordinates found in the file with the following formats : (Both coordinates have the same Y-value but different X-values)

Y1 X11 X12
Y2 X21 X22
Y3 X31 X32
.




P>

I use it in r (sections) Thousands of lines will be generated by plotting the lines for those coordinates which were able to find a way, so I want to use GGL2 to give the alpha level for line colors so that those areas can check the plots which There are more number of downward lines.

I'm not sure this is what you need:

  Library (ggplot2) #some data df & lt; -data.frame (y = 1: 1000, x1 = sample (1: 100.1000, replace = t)) DF $ x2 & lt; -df $ x1 + sample (5: 10,1000, replace = t) ggplot () + Geom_segment (data = df, aes (x = x1, y = y, xend = x2, yend = y), color = " Red ", alpha = 0.5)    

No comments:

Post a Comment