Skip to content
Prev 180626 / 398506 Next

wireframe 3-D problems

Xu Jun wrote:
Your x and y variables were only evaluated along a single line,
not over the entire grid (other solutions are possible using
outer() and rep() ...)

x <- seq(-4, 4, by=0.25)
y <- seq(-4, 4, by=0.25)
mydata <- expand.grid(x=x,y=y)
p <- 1/(1+exp(-0.12*mydata$x + 0.35*mydata$y))
mydata <- data.frame(x=mydata$x,y=mydata$y,p)
require(lattice)
wireframe(p~x*y, data=mydata)
## should play with "screen" argument, see ?panel.wireframe