[Rd] Re: [R] persp(): add second plane

Uwe Ligges ligges@amadeus.statistik.uni-dortmund.de
Mon, 25 Mar 2002 15:53:37 +0100

Uwe Ligges wrote:
> Ben Bolker wrote:
> >
> >   [forwarded to R-devel]
> >
> >   I'm most interested in integrating persp() and scatterplot3d() so that
> > we can (e.g.) easily draw graphs like response surfaces with associated
> > points (yes, there are serious questions about whether 3d perspective
> > plots are good general tools for data presentation, but there are some
> > places where it's really useful).  I can think of a bunch of quick hacks,
> > but I don't really know how an integrated system should be designed for
> > consistency and ease of use.
> I think it's not possible to write an integrated system that uses the
> functions scatterplot3d() and persp() as they are. The straightforward
> way, from my point of view, is to write a new function (suggestions for
> a name?) along scatterplot3d()'s code, that uses persp() instead of
> scatterplot3d()'s own plot function in principle.
> I'll volunteer to write such a function during the next months, but
> there are still some other points on my todo list (and I myself don't
> need such a function at present).

After some investigations:
I think for a really clean solution for plotting surfaces *and*
points/lines or other elements into a *perspective* 3D plot a redesign
of persp() is needed, or much better a whole 3D graphics system in R
(very similar to the existing 2D graphics system), but I don't have the
time to work on the latter.

Instead of the above mentioned solutions, I did a quick hack and added a
function s3d.persp() to the package scatterplot3d_0.3-10. This version
is *only* available at
http://www.statistik.uni-dortmund.de/leute/ligges.htm .
The function can plot points and other elements into surface plots.
Most of the code is stolen from persp() and scatterplot3d().
Bug (not so easy to fix, needs the redesign mentioned above): All
elements except the surface are plotted in front of the surface, even if
they shouldn't appear (i.e. located behind or below the surface).
I don't want to upload to CRAN until the function is not tested
extensively and as long it is heavily under development. Bug reports and
suggestions are welcome.

Uwe Ligges
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch