RE: [R] persp( ) Question

From: Brahm, David <David.Brahm_at_geodecapital.com>
Date: Sat 07 May 2005 - 04:16:19 EST


Greg,

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

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

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

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


R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Sat May 07 04:23:38 2005

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