[Rd] can't plot a line

Barry Rowlingson b.rowlingson at lancaster.ac.uk
Tue Jan 23 17:19:27 CET 2007


Spencer Graves wrote:
> Consider the following: 
> 
>       plot(0, 0, xlim=c(-10, 10), ylim=c(-50, 50))
>       lines(c(0,0), (2*c(-pi, pi))^2)

  Because squaring is done before multiplication - its higher priority. 
Hence you end up with (-2*pi)^2 and (2*pi)^2, which are the same, and 
your 'line' becomes a dot.

  How about: lines(c(0,0), (2*pi)^2*c(-1,1))

Barry



More information about the R-devel mailing list