Friday, April 5, 2013

RG#14: 3D plot - wireframe plot

 # data
XV <- seq(-4, 4, len = 40)
 YV <- seq(-4, 4, len = 40)
datf <- expand.grid(xvar = XV, yvar = YV)
 datf$ZV<-  datf$xvar^2 + datf$yvar^2 - 2*datf$xvar* datf$yvar


# plot
require(lattice)
wireframe(ZV ~ xvar* yvar, data = datf)


wireframe(ZV ~ xvar* yvar, data = datf, drape = TRUE, perspective = FALSE, aspect = c(3,2), colorkey = TRUE)

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.