Note that there are some explanatory texts on larger screens.

plurals
  1. POPlotting a wireframe AND a cloud with lattice in R
    primarykey
    data
    text
    <p>I have a nice surface that represents nonlinear multi-part regression results on a regression with two independent variables. I would like to plot the regression predicted values as a nice 3D surface and then show the actual values as point that bounce around the surface. This would be the 3D version of plotting a regression line and showing the actuals as points around the line. I can't figure out how to do this with lattice. I'm happy to use another graphing library in R, but I don't know of others that do 3D plots. </p> <p>Here's a simplified version of what I want to do:</p> <pre><code>library(lattice) #set up some simplified data x &lt;- seq(-.8, .8, .1) y &lt;- seq(-.8, .8, .1) myGrid &lt;- data.frame(expand.grid(x,y)) colnames(myGrid) &lt;- c("x","y") myGrid$z &lt;- myGrid$x + myGrid$y noise &lt;- rnorm(length(myGrid$z),.3,.2) myGrid$z2 &lt;- myGrid$x + myGrid$y + noise </code></pre> <p>z is my smooth surface and z2 are my noisy points mostly slightly above the surface. So the surface looks like this:</p> <pre><code>wireframe(myGrid$z ~ myGrid$x * myGrid$y, xlab="X", ylab="Y", zlab="Z") </code></pre> <p><a href="http://www.cerebralmastication.com/wp-content/uploads/2009/09/wireframe.png" rel="noreferrer">alt text http://www.cerebralmastication.com/wp-content/uploads/2009/09/wireframe.png</a></p> <p>and the cloud of points looks like this:</p> <pre><code>cloud(myGrid$z2 ~ myGrid$x * myGrid$y, xlab="X", ylab="Y", zlab="Z") </code></pre> <p><a href="http://www.cerebralmastication.com/wp-content/uploads/2009/09/cloud.png" rel="noreferrer">alt text http://www.cerebralmastication.com/wp-content/uploads/2009/09/cloud.png</a></p> <p>Is it possible to get both of these in one lattice panel?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload