[R] To add cut-off points in surface response with lattice

Ivan Allaman ivanalaman at yahoo.com.br
Sat Jun 11 14:32:35 CEST 2011


Good morning gentlemen! 

I'm not a fan of the lattice due to a large number of procedures what should
be done to reach a simple goal, but have confess that in some cases the
graphics are way better than the graphics. Some days I have been searching
without success as is to add a cut-off point on a graph of response surface.
It is interesting that the researcher to look at the graph spotting cut-off
point. Here is a minimal code reproducible. 

require(plotrix)
jet.colors <- colorRampPalette( c("blue", "green") )  
x <- seq(-1.95, 1.95, length=30)
y <- seq(-1.95, 1.95, length=35)
da <- expand.grid(x=x, y=y)
da$z <- with(da, x*y^2)

require(lattice)
panel.3d.contour <-
  function(x, y, z, rot.mat, distance,
           nlevels = 20, zlim.scaled, ...)
  {
    add.line <- trellis.par.get("add.line")
    panel.3dwire(x, y, z, rot.mat, distance,
                 zlim.scaled = zlim.scaled, ...)
    clines <-
      contourLines(x, y, matrix(z, nrow = length(x), byrow = TRUE),
                   nlevels = nlevels)
    for (ll in clines) {
      m <- ltransform3dto3d(rbind(ll$x, ll$y, zlim.scaled[1]),
                            rot.mat, distance)
      panel.lines(m[1,], m[2,], col = add.line$col,
                  lty = add.line$lty, lwd = add.line$lwd)
    }
  }
wireframe(z~x+y, da, drape=TRUE,
scales=list(arrows=FALSE),col.regions=jet.colors(100),panel.3d.wireframe="panel.3d.contour")


Tank' s!

--
View this message in context: http://r.789695.n4.nabble.com/To-add-cut-off-points-in-surface-response-with-lattice-tp3590414p3590414.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list