--On Wednesday, October 25, 2006 4:46 PM -0700 Deepayan Sarkar <[EMAIL PROTECTED]> wrote:
> On 10/25/06, Larry Layne <[EMAIL PROTECTED]> wrote: >> Per the message from Alexander Nervedi, 29 April 2006: >> >> > I have to be making a riddiculously silly ommission. >> > when I run the fillowing i get the cloud plot ok. But I cant figure >> > out what I am missing out when I call wireframe. >> >> > Any help would be appreciated. >> >> > x<-runif(100) >> > y<-rnorm(100) >> > z<-runif(100) >> >> > temp <-data.frame(x,y,z) >> > wireframe(x~y*z,temp) >> > cloud(x~y*z,temp) >> >> There is something funny about the way wireframe treats a data frame >> object created using "data.frame" vs. using "expand.grid". For instance, >> this works: > > There's nothing funny about it, ?wireframe clearly says: > > In the case of 'wireframe', > calculations are based on the assumption that the 'x' and 'y' > values are evaluated on a rectangular grid defined by their > unique values. Sorry about incorrectly interpreting this part of the description about wireframe. > In the original example, the (x, y) values are clearly not on a grid, > and in your (very strange) example below, they are not on a > rectangular grid, as can be seen using > > xyplot(u ~ v, reggrid) One of the nice things about posting questions in a list is that it is so conveniently easy to embarrass oneself in public. The corrected code follows and works just fine: library(lattice) ###MAKE-BELIEVE DATA u <- mat.or.vec(100,1) v <- mat.or.vec(100,1) ij=0 for(i in 1:10) { for(j in 1:10) { ij=ij+1 u[ij]=i v[ij]=j } } z <- runif(100) reggrid <- data.frame(u,v,z) is.data.frame(reggrid) wireframe(z~u*v,reggrid,scales=list(arrows=FALSE),drape=TRUE,colorkey=TRUE) >> In addition, I would also like to >> do what Alexander is trying to do, which is create a wireframe from >> irregular lattice data. Although what I would really like to do is plot a 3D Triangulated Irregular Network (TIN) surface of the irregularly spaced points, the following sort of gets me there in the short-term: ##INTERPOLATE USING AKIMA PACKAGE AND PLOT SURFACES library(akima) library(lattice) #MAKE-BELIEVE DATA u <- runif(30) v <- runif(30) z <- runif(30) #LINEAR INTERPOLATION reggrid <- interp(u,v,z,linear=TRUE,extrap=FALSE) #WIREFRAME SURFACE PLOT FROM INTERPOLATED DATA wireframe(reggrid$z,scales=list(arrows=FALSE),drape=TRUE,colorkey=TRUE) #PLOT IMAGE, CONTOUR, AND POINTS plot(u,v) image (reggrid,add=TRUE) contour(reggrid,add=TRUE) points (u,v,pch = 3) Larry Layne ______________________________________________ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.