[R] 3D-plots of 2D-grids

David Winsemius dwinsemius at comcast.net
Fri Feb 15 22:03:32 CET 2013


Compare:

persp(matrix(c(1,1,NA,NA,
                  1,1,NA,NA,
                  1,NA,NA,NA,
                   1,NA,NA,1), 4,4), zlim=c(0,2))

persp(matrix(c(1,1,0,0,
                 1,1,0,0,
                 1,0,0,0,
                  1,0,0,1), 4,4), zlim=c(0,2))

-- 
David.


On Feb 15, 2013, at 12:01 PM, David Winsemius wrote:

> 
> On Feb 15, 2013, at 1:14 AM, jas wrote:
> 
>> Hello David,
>> thanks again for your reply.
>> 
>> Two things remain unclear. That the data is disjointed is ok, as there are
>> only values in hectares, where there are actually buildings and stuff,
>> forest/nature is NA. 
>> 
>> The presp-scan that I get from persp(grd) has no similarity to the image in
>> 2d. My guess is that the order and regularity in the data somehow gets lost
>> in the process of making the matrix?! 
> 
> I think the disjointedness is the problem. There are many values where there is no adjacent value in one direction of another and so no tessellation can be formed. If you look at the image result and note the places where there are "solid values" in both x and y directions I think the overall patterns match up. The image result is more faithful to the data.
> 
>> 
>> The grid-extraction that I uploaded contains 40x20 cells. if its a bigger
>> grid with 7million cells, does it still work the same way or can the vectors
>> only be a maximum of 100 cells? 
> 
> Might be a performance problem although I don't think it is theoretically impossible. An 8000 x 8000 matrix consumed my full CPU resources and essentially locked up my session. I'm in the process of deciding when to halt it.
> 
> Are you aware that there are far more knowledgeable persons than I that hang out at the R-SIG-Geo list?
> 
> -- 
> David
> 
>> 
>> Thank you for your help
>> jas
>> 
>> 
>> 
>> --
>> View this message in context: http://r.789695.n4.nabble.com/3D-plots-of-2D-grids-tp4658517p4658639.html
>> Sent from the R help mailing list archive at Nabble.com.
>> 
>> ______________________________________________
>> R-help at r-project.org 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.
> 
> David Winsemius
> Alameda, CA, USA
> 
> ______________________________________________
> R-help at r-project.org 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.

David Winsemius
Alameda, CA, USA



More information about the R-help mailing list