trans3d {fields} | R Documentation |
Uses the projection matrix returned by persp to transform x,y,z values to 2d plotting region.
trans3d(x, y, z, pmat)
x |
vector of x values |
y |
vector of y values |
z |
vector of z values |
pmat |
projection matrix returned by persp |
A list
x |
values of x coordinate in plotting scale |
comp2 |
values of y coordinate in plotting scale |
...
D. Nychka (but really who ever wrote the persp help file)
persp, drape.plot
# Mr. R's favorite New Zealand Volcano! data( volcano) M<- nrow( volcano) N<- ncol( volcano) x<- seq( 0,1,,M) y<- seq( 0,1,,N) persp( x,y,volcano,phi=30, theta=30)-> pm #point at (.5,.5,.9) trans3d( .5,.5,180, pm)-> uv points( uv, pch="o", cex=2, col="red") # add a contour line # contourLines( x,y,volcano)[10][[1]]-> out z<- rep( out$level, length( out$x)) trans3d( out$x, out$y, z, pm)-> uv lines( uv, col="blue", lwd=2)