PerfectTiling
2009-Oct-19 04:26 UTC
[R] Variant of cloud with "sticks" from points to surface
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! PT -- View this message in context: http://www.nabble.com/Variant-of-cloud-with-%22sticks%22-from-points-to-surface-tp25953179p25953179.html Sent from the R help mailing list archive at Nabble.com.
Dieter Menne
2009-Oct-19 09:01 UTC
[R] Variant of cloud with "sticks" from points to surface
PerfectTiling wrote:> > (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. > >In the rgl package, there are some examples that come close to what you want. Dieter -- View this message in context: http://www.nabble.com/Variant-of-cloud-with-%22sticks%22-from-points-to-surface-tp25953179p25955170.html Sent from the R help mailing list archive at Nabble.com.
Barry Rowlingson
2009-Oct-19 11:31 UTC
[R] Variant of cloud with "sticks" from points to surface
On Mon, Oct 19, 2009 at 5:26 AM, PerfectTiling <perfecttiling at 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
Rolf Turner
2009-Oct-19 18:47 UTC
[R] Variant of cloud with "sticks" from points to surface
On 19/10/2009, at 5:26 PM, PerfectTiling 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.Perhaps the scatterplot3d package is what you're looking for. cheers, Rolf Turner ###################################################################### Attention:\ This e-mail message is privileged and confid...{{dropped:9}}