Re: [R] question on contour function

2010-08-12 Thread ba ba
Duncan and David, thank you so much. You are right. We can use z1 - outer(x, y, function(x,y) x^2+3*y^2) rather than xy - meshgrid(x,y) z2 - xy$x^2+ 3*xy$y^2 to get right answer. I run these codes on my computer and found that z2 is the transpose of z1. So I guess in order to obtain

[R] question on contour function

2010-08-11 Thread ba ba
Dear All, I tried to plot contour lines using R function contour, but got the results which are not expected. require(RTOMO) x - seq(-1,1,0.1) y - seq(-1,1,0.1) xy - meshgrid(x,y) z - xy$x^2+ 3*xy$y^2 contour(x,y,z,col=blue,xlab=x,ylab=y) The above code gave me the contour graph for

Re: [R] question on contour function

2010-08-11 Thread Duncan Murdoch
On 11/08/2010 11:16 AM, ba ba wrote: Dear All, I tried to plot contour lines using R function contour, but got the results which are not expected. require(RTOMO) x - seq(-1,1,0.1) y - seq(-1,1,0.1) xy - meshgrid(x,y) z - xy$x^2+ 3*xy$y^2 contour(x,y,z,col=blue,xlab=x,ylab=y) The above code

Re: [R] question on contour function

2010-08-11 Thread David Winsemius
On Aug 11, 2010, at 11:16 AM, ba ba wrote: Dear All, I tried to plot contour lines using R function contour, but got the results which are not expected. require(RTOMO) x - seq(-1,1,0.1) y - seq(-1,1,0.1) xy - meshgrid(x,y) z - xy$x^2+ 3*xy$y^2 contour(x,y,z,col=blue,xlab=x,ylab=y) The