[R] Invalid Z argument error in persp.default
Duncan Murdoch
murdoch.duncan at gmail.com
Tue Sep 24 13:52:44 CEST 2013
On 13-09-24 6:19 AM, Babak Bastan wrote:
> I do the folloowing in order to get 3D Plot:
>
> y<-1:(point/2)
> x<-20:30
> z<-r[1:(point/2)]
> persp(x,y,z,theta = 135, phi = 30, col = "green3", scale = FALSE,
> ltheta = -120, shade = 0.75,
> border = 1)
>
>
> y:
>
> [1] 1 2 3 4 5
>
> x:
>
> [1] 20 21 22 23 24 25
>
> z:
>
> [1] 4811.000000 3.593025 6.968666 4.908174 5.332700
>
> but i always get the error message Error in persp.default(x, y, z, theta =
> 135, phi = 30, col = "green3", :invalid 'z' argument
>
> How may I solve the issue?
See ?persp. z should be a 5x5 matrix to match your x and y.
Duncan Murdoch
More information about the R-help
mailing list