title: Filled in R gradient curve
body: <p>I have a curve I am using R to make (see code below):</p>
  
  <pre><code>library(rgl)
  
  y = seq(-5,25,by=0.01)
  x = seq(5,20,by=0.02)
  
  sd = 0.3*x
  NAs &lt;- rep(NA, length(x)*length(y))
  z &lt;- matrix(NAs, length(x), byrow = T)
  for(i in seq(1,length(x))) {
      for(j in seq(1,length(y))) {
          val = dnorm(y[j],mean=7.5,sd=sd[i])     
          z[i,j] = val
          if(z[i,j] &lt; 0.02) {
              z[i,j] = NA
          }
      }
  }
  
  col &lt;- rainbow(length(x))[rank(x)]        
  
  open3d()
  persp3d(x,y,z,color=col,xlim=c(5,20),ylim=c(5,10),axes=F,box=F,xlab="exp",ylab="obs",zlab="p")
  </code></pre>
  
  <p>And here's what it makes:
  <img src="https://i.stack.imgur.com/p0wBB.png" alt="enter image description here"></p>
  
  <p>If you rotate it a bit, you'd be able to see that this is a hollow tube type figure. </p>
  
  <p><img src="https://i.stack.imgur.com/kNyQK.png" alt="enter image description here"></p>
  
  <p>But I'm trying to make it be filled in (with the color gradient) so that it's not hollow. Imagine taking a slice at any location, and you'd get a 2D plane, not a 2D curve, if that makes sense. How can I do this?</p>