RE: [R] persp( ) Question

From: Martin Maechler <>
Date: Sun 15 May 2005 - 00:25:11 EST

>>>>> "DavidB" == Brahm, David <>
>>>>> on Fri, 6 May 2005 14:16:19 -0400 writes:

    DavidB> Greg, Assign the output of "persp" to a variable     DavidB> "pmat":
    R> pmat <- persp(X.grid, Y.grid, pred.loess1, theta=0,     R> phi=12)

    DavidB> Now you can add points to your plot with the usual
    DavidB> "points" command.  But you have to translate your 3D
    DavidB> coordinates (x,y,z) into 2D coordinates for "points"
    DavidB> to understand, and that's what "trans3d" does:

    R> points(trans3d(x,y,z, pmat), col="red")

    DavidB> You supply the (x,y,z) values, of course.  It's a
    DavidB> mystery to me why "trans3d" is not included in the
    DavidB> graphics package (where "persp" lives).  HTH.

Yes, I had similar thoughts many weeks ago, and already then prepared to add to trans3d(). Will do this now (for R 2.2.0).

Martin mailing list PLEASE do read the posting guide! Received on Sun May 15 00:29:44 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:31:46 EST