seq(-1,1,0.1)
xy <- meshgrid(x,y)
z <- xy$x^2+ 3*xy$y^2
z <- t(z)
contour(x,y,z,col="blue",xlab="x",ylab="y")
Of course, the first method is better since it only uses the base function.
David Lee
On 12 August 2010 01:54, David Winsemius 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 gave me the contour graph for z
2 matches
Mail list logo