Skip to content
Prev 277946 / 398506 Next

persp() problem

Your call to persp() is fine, and works just fine for me.
Obviously there is something funny about your data
(x, y, and z).   They must not be numeric (despite appearances).
There is something you haven't told us here; how did you
obtain/construct x, y, and z?

Try the following:

x <- y <- 5*(0:4)
z <- matrix(scan(textConnection(
         "4.538 9.169  23.518 32.794 39.322
          5.013 13.104 33.282 42.202 45.474
          5.296 17.728 36.989 43.89  46.57
          5.366 20.94  39.244 44.987 47.177
          5.642 23.396 40.842 45.489 47.126")),5,5,byrow=TRUE)
closeAllConnections()
persp(x,y,z)
readline("Go? ")

# Or better:
persp(x,y,z,theta=-30,phi=40,d=4)

     cheers,

         Rolf Turner
On 20/11/11 09:19, John Benning wrote: