I\'ve got some x and y coordinates that I am trying to plot into line segments. And I\'m getting some unexpected behavior from what I think should work.
For each se
The segments
function is what you are looking for:
> data
x1 y1 x2 y2
1 34.9 67.9 62.5 68.8
2 66.8 80.9 58.8 88.4
3 58.8 88.4 66.0 68.4
4 64.0 65.8 56.2 62.6
5 56.2 62.6 56.6 75.3
6 54.5 70.0 72.9 51.3
> plot(range(data$x1,data$x2), range(data$y1, data$y2),type="n")
> segments(data$x1, data$y1, data$x2, data$y2)
Note you have to set the plot up first. You might want to do:
> plot(NA, xlim=c(0,100), ylim=c(0,100), xlab="x", ylab="y")
> segments(data$x1, data$y1, data$x2, data$y2)
to get the bounds in your figure.