[R-sig-Geo] plot3D raster coordinates

Robert Hijmans r.hijmans at gmail.com
Fri Jul 15 02:19:49 CEST 2011

> (plot3D is in fact in the rasterVis package now) 
> There's an adjustment factor additional to the zfac parameter. It is 
> impossible to override it. The solution I've found is to comment these
> lines 
> and run the function under another name (these lines are present 2 times). 
>#         adj <- zlen/min(ylen,xlen) 
>#         X <- X * adj * zfac 
>#         Y <- Y * adj * zfac
>If you need to keep the zfac, I'd suggest to put it directly on Z. 
>Z <- t((getValues(x, format='matrix'))[nrow(x):1,]) * zfac 
>I'd be curious to hear why is the z scaling factor is applied in that 

The zfac could be changed, but I think the main issue is the "adj" factor
that scales the x, y and z values to get a nice 3D plot. It may be possible
to do this differently, and I will try to do that; I had overlooked this
problem (of wrong coordinates on the axis, and not being able to correctly
plot vector data on top). Thanks for pointing this out, 


View this message in context: http://r-sig-geo.2731867.n2.nabble.com/plot3D-raster-coordinates-tp6558234p6585449.html
Sent from the R-sig-geo mailing list archive at Nabble.com.

More information about the R-sig-Geo mailing list