[R] 3D plotting in R

Uwe Ligges ligges at statistik.uni-dortmund.de
Fri Sep 19 08:30:24 CEST 2003

Richard A. O'Keefe wrote:

> A student is trying to cluster some data.  Tree-building things seem to
> be pretty hopeless (we've tried most of the ones in R, I think).
> Multi-dimensional scaling produces somewhat tantalising results:
> things do clump together somewhat, but the clusters overlap a lot.
> I was wondering if these was an artefact of squeezing it down to 2D,
> and whether 3D might be better.  So
> loc <- cmdscale(dist(scale(log(data))), k=3)
> plot(loc)
> _but_ I still get a 2D plot.
> I know about persp(), and a bunch of other things in R that give me
> a 3d view of a 2d field (plots of a function of 2 arguments, in other
> words).  But I want to plot a bunch of 3D points and label them.

Try cloud() in package lattice or scatterplot3d() in package scatterplot3d.

> If the worst comes to the worst, I'll dump them out in a file and use
> XLispStat to view them.
> I've asked previously whether there's a spinning plot in R, and have been
> told that there isn't and why.  I've been given one anyway, but it calls
> Tcl/Tk, and for some reason that doesn't work in my setup.

There are the packages "rgl" and "djmrgl" (the latter on Windows only) 
for spinning.

Uwe Ligges

More information about the R-help mailing list