Question

I have a some data in an exel file with 128 rows and 400 column.I am reading this Excel file into a Matrix with 128X400. Now I want to draw 3D Plott using presp in r. Which parameters from this Matrix should be passed to persp?

UPDATE

I have this Matrix for example and I want to generate a 3D Plot, but I get an error:

k<-c(1,2,3,4,5,6,7,8,9,10,11,12,62,25,2)
k<-matrix(k,nrow=3)
op <- par(bg = "white")
persp(ncol(k), nrow(k), k, theta = 30, phi = 30, expand = 0.5, col = "lightblue")

Error:

Error in persp.default(ncol(k), nrow(k), k, theta = 30, phi = 30, expand = 0.5,  : 
  invalid 'x' argument
Was it helpful?

Solution

Thanks for the reproducible example.

persp(z=k)

should do what you want. The help page ?persp may be helpful.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top