[R] 3d graph to show matrix of z matrix values

Duncan Murdoch murdoch.duncan at gmail.com
Sat Oct 29 02:02:08 CEST 2011


On 11-10-28 11:34 AM, playballa23 wrote:
>> Hello,
>>
>> I'm not getting a great looking 3d graph when plotting my z values:
>>
>>       x<- seq(0.0, max(d1), max(d1)/20)
>>       y<- seq(0.0, max(d2), max(d2)/20)
>>       z<- matrix(NA, length(x), length(y))
>>
>> persp3d(x, y, z, phi=30, theta=30, scale=TRUE,shade = 0.75,
>> col=pal[col.ind], xlab=var.name[1], ylab=var.name[2], main="3d plot")
>
> Your z values are all NA.  What are you expecting to see?
>
> *z values*:
> i<- 0
>      for (el.x in x)
>      {
>        i<- i+1
> 	    j<- 1	
> 	    for (el.y in y)
> 		  {
>          if( el.x==0&  el.y==0) *z[i,j]*<- Emax + B
>          if(!(el.x==0&  el.y==0)) *z[i,j]*<- model(el.x, el.y, m1, m2, dm1,
> dm2, alpha)
>          j<- j+1
>        }
>      }
>

Is that supposed to respond to my statement or my question?  It doesn't 
seem to do either...

Duncan Murdoch



More information about the R-help mailing list