title: 3d plot in R - Patch
body: <p>I have the following data in a data frame:</p>
  
  <pre><code>**x** in (0,1)
  **y** in [0,1]
  **z** in [0,1]
  </code></pre>
  
  <p>For example:</p>
  
  <pre><code>X,Y,Z
  0.1, 0.2, 0.56
  0.1, 0.3, 0.57
  ...
  </code></pre>
  
  <p>I'd like to plot them on this type of chart:
  <img src="https://i.stack.imgur.com/6K2U4.png" alt="A 3d plot"></p>
  
  <p>I tried on R, but all I could get was a <a href="http://www.statmethods.net/graphs/images/s3d2.png" rel="noreferrer">not-so-fancy 3d scatterplot</a>.
  I also read about the <a href="http://www.stat.ucl.ac.be/ISpersonnel/lecoutre/stats/fichiers/_gallery.pdf" rel="noreferrer">lattice 3d wireframe</a>, but I couldn't get my head around it.</p>
  
  <p>What am I supposed to do to get a Matlab like wireframe in R?
  What data transforms are involved?</p>
  
  <p>This is the sample code from the documentation:</p>
  
  <pre><code>x &lt;- seq(-pi, pi, len = 20)
  y &lt;- seq(-pi, pi, len = 20)
  g &lt;- expand.grid(x = x, y = y)
  g$z &lt;- sin(sqrt(g$x^2 + g$y^2))
  wireframe(z ~ x * y, g, drape = TRUE,
  aspect = c(3,1), colorkey = TRUE)
  </code></pre>
  
  <p>I don't find it particularly clear.</p>
  
  <p><strong>EDIT</strong>: the <code>persp3d</code> function works fine, and I was able to generate a 3d plot with one colour. How can I set a colour scale relative to the z value?</p>
  
  <p>Thanks for any hints,
  Mulone</p>