title: How to assign color scale to a variable in a 3D scatter plot?
body: <p>I'm a beginner in R and needs a bit of help for my scripting.
  I managed to generate scale color gradient using library(ggplot2) on my 2D plots as follows;</p>
  
  <pre><code>z &lt;- c(data$conf)
  d &lt;- qplot(x, y, xlab="Dimension 1", ylab="Dimension 2", colour=z)
  d
  d + scale_colour_gradient(limits=c(0, 1), data=data$conf, low="blue", high="red"))
  </code></pre>
  
  <p>I'm now trying to reproduce this gradient on a 3D plot, I used scatterplot3d or plot3d. I believe the colorRampPalette create a color gradient based on 327 rows (1…327) while I'm interested in  a gradient that is function of values in data$conf. I need a connection, but where?</p>
  
  <pre><code>attach(data)
  t1 &lt;- c(data$conf)
  jet.colors &lt;- colorRampPalette(c("blue", "red"))
  e &lt;- plot3d(x, y, z, col=jet.colors(327))
  </code></pre>
  
  <p>If you can help me that will be great – Or if you know any 3D plot/scale gradient package that can do a better job, cool too.</p>