On 10/10/06, Gustaf Granath <gustaf.granath at ebc.uu.se>
wrote:> Hi,
> I want to make a surface3D plot of a landscape. I have cordinates (x, y, z)
> recorded with a GPS. The datapoints are not evenly distributed within the
> rectangular area.
>
> To do a fast 3D plot I used following.
>
> > library(grid)
> > library(lattice)
> > v <- read.table("clipboard")
> > names(v) <- c("x", "y", "z")
> > wireframe(z ~ x * y, data = v)
>
> However I just get an empty box with no 3D grid. I have tried with other
data
> and then it usually works. But I cant get it to work with my data.
> Here is a sample of my data (x, y, z). I think there is something in my
data set
> that wireframe doesnt like.
Yes, and you have already stated what that is, namely that "The
datapoints are not evenly distributed within the rectangular area". As
it says in the first multiple-sentence paragraph in help page for
wireframe:
... 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. The grid points need not be equally spaced.
You need to use your favorite smoothing method to evaluate z values on
a grid. ?levelplot has an example using loess (the akima package is
also popular, although I'm not personally familiar with it).
Another alternative is using some form of triangulation (e.g. voronoi
tesselation). This should be possible, but is not trivial.
-Deepayan
> Any ideas?? Are there better commands to use?
> (I have tried to change the magnitude of the numbers but that doesnt help)
> y x z
> 6659592.078 1585162.959 59.229
> 6659591.348 1585164.402 59.159
> 6659590.494 1585163.294 59.205
> 6659589.466 1585158.968 59.290
> 6659589.229 1585159.390 59.246
> 6659588.963 1585158.895 59.201
> 6659589.475 1585158.617 59.199
> 6659589.808 1585159.206 59.135
> 6659592.361 1585161.707 59.447
> 6659592.387 1585161.319 59.437
> 6659592.590 1585161.871 59.217
> 6659591.989 1585162.156 59.163
> 6659591.934 1585161.489 59.358
> 6659590.340 1585158.060 59.352
> 6659590.228 1585157.714 59.138
> 6659590.957 1585157.947 59.145
> 6659590.422 1585158.344 59.214
> 6659589.904 1585158.024 59.175
> 6659589.877 1585162.033 59.346
> 6659589.967 1585161.674 59.197
> 6659590.109 1585162.062 59.205
> 6659589.778 1585162.572 59.152
> 6659589.591 1585161.876 59.187
> 6659591.783 1585156.210 59.561
> 6659592.164 1585156.764 59.266
> 6659590.352 1585156.154 59.339
> 6659590.890 1585154.720 59.278
> 6659592.520 1585155.023 59.250
> 6659593.127 1585166.690 59.217
>
> Regards,
> Gustaf