Re: [R] Plotting multiple ablines

2009-04-03 Thread Thomas Levine
I've really been on a roll this week; the formula for the lines that I presented was completely wrong. But I'm glad I learned about mapply. I used this: mapply(abline, (converge$kY + tan((90-converge$kT) * pi / 180)*(-converge$kX)), tan((90-converge$kT) * pi / 180)) Tom! On Thu, Apr 2,

Re: [R] Plotting multiple ablines

2009-04-02 Thread Uwe Ligges
Rolf Turner wrote: On 2/04/2009, at 7:04 AM, Thomas Levine wrote: I really want to do this: abline( a=tan(-kT*pi/180), b=kY-tan(-kT*pi/180)*kX ) where kX,kY and kT are vectors of equal length. But I can't do that with abline unless I use a loop, and I haven't figured out the least

Re: [R] Plotting multiple ablines

2009-04-02 Thread r...@quantide.com
May be: plot(c(-1, 1) , c(-1, 1), type = n) n = 4 a = rep(0, n) b = 1:n/n fun = function(i, a, b, col = 1 , ...) { abline(a[i], b[i], col = col[i], ...) } lapply(1:n, fun, a=a, b=b, col = 1:n) Andrea Thomas Levine wrote: I really want to do this: abline( a=tan(-kT*pi/180),

[R] Plotting multiple ablines

2009-04-01 Thread Thomas Levine
I really want to do this: abline( a=tan(-kT*pi/180), b=kY-tan(-kT*pi/180)*kX ) where kX,kY and kT are vectors of equal length. But I can't do that with abline unless I use a loop, and I haven't figured out the least unelegant way of writing the loop yet. So is there a way to do this without a

Re: [R] Plotting multiple ablines

2009-04-01 Thread Rolf Turner
On 2/04/2009, at 7:04 AM, Thomas Levine wrote: I really want to do this: abline( a=tan(-kT*pi/180), b=kY-tan(-kT*pi/180)*kX ) where kX,kY and kT are vectors of equal length. But I can't do that with abline unless I use a loop, and I haven't figured out the least unelegant way of writing the