Learn R Programming

fields (version 2.3)

trans3d: Converts 3-d coordinates to 2-d plotting coordinates

Description

Uses the projection matrix returned by persp to transform x,y,z values to 2d plotting region.

Usage

trans3d(x, y, z, pmat)

Arguments

Value

A listxvalues of x coordinate in plotting scalecomp2values of y coordinate in plotting scale...

See Also

persp, drape.plot

Examples

Run this code
# 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)

Run the code above in your browser using DataLab