[R] What does persp() return?

David Brahm brahm at alum.mit.edu
Fri Aug 2 02:03:13 CEST 2002


Thanks very much to Paul Murrell, Ben Bolker, and Peter Dalgaard for
responding.  Sorry I failed to find the 3/15/02 discussion of this same topic.
May I suggest that the omission of the returned value from the help page for
persp() is a "documentation bug"?  Something like this could be added:

Value:
  A 4x4 matrix (call it "pmat"), suitable for transforming 3D coordinates
(x,y,z) into list(x,y) values.  These can then be used by lines(), points(),
etc, to superimpose additional data on the 3D plot.  The transformation can be
accomplished with the following function:

  trans3d <- function(x,y,z, pmat) {
    tmat <- t(cbind(x,y,z,1) %*% pmat)
    list(x=tmat[1,]/tmat[4,], y=tmat[2,]/tmat[4,])
  }

-- 
                              -- David Brahm (brahm at alum.mit.edu)
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help 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-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list