On Mon, Oct 19, 2009 at 5:26 AM, PerfectTiling <perfecttil...@yahoo.com> wrote: > > Hi, > > I'd like to > > (1) plot a perspective view of a 3D scatterplot, with a fitted (curved) > surface; > (2) have a "stick" from each point vertically to the surface. > > The latter helps one visualize where a point lies in 3D, relative to the > surface. Is there a variant of the cloud function (lattice package) which > might do this? As far as I can tell, the cloud function will (essentially) > only plot the a stick from a point to z=0, rather than to the surface. > > Thanks in advance!
If you use the persp function from base graphics instead of cloud from lattice you can then use the trans3d function to convert from your 3d coords to 2d viewport coords. Then you can add the sticks using 'lines' or 'segments'. There's an example usage in help(persp) where a sine-curve is plotted along the edge of a 3d plot. I don't know if an equivalent transformation function exists for lattice graphics. Barry ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.