[R] cloud() works but wireframe() is blank
Deepayan Sarkar
deepayan.sarkar at gmail.com
Thu Oct 26 01:46:06 CEST 2006
On 10/25/06, Larry Layne <ljlayne at unm.edu> 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.
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)
> reggrid <- expand.grid(u=1:10,v=1:10)
> reggrid$z <- runif(100)
> reggrid <- data.frame(reggrid)
> is.data.frame(reggrid)
> wireframe(z~u*v,reggrid,scales=list(arrows=FALSE),drape=TRUE,colorkey=TRUE)
>
> but this does not:
>
> u <- c(1:100)
> v <- mat.or.vec(100,1)
> ij=0
> for(i in 1:10)
> {
> for(j in 1:10)
> {
> ij=ij+1
> 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)
>
> Does anyone have any insight on this? In addition, I would also like to do
> what Alexander is trying to do, which is create a wireframe from irregular
> lattice data.
See a recent thread at
http://tolstoy.newcastle.edu.au/R/e2/help/06/10/2525.html
-Deepayan
More information about the R-help
mailing list