[R-sig-Geo] vectorplot rasterVis adjust length of arrows

andre.stumpf at unistra.fr andre.stumpf at unistra.fr
Mon Feb 3 17:02:39 CET 2014


Hi,

I use rasterVis's vectorplot function to visualize vector fields
(rasterVis_0.27, R version 3.0.2, Platform: x86_64-w64-mingw32/x64 (64-bit))
from a raster stack in UTM coordinates. 

The example from the vectorplot help to illustrate the issue:

u <- v <- raster(xmn=0, xmx=2, ymn=0, ymx=2, ncol=1e3, nrow=1e3)
x <- init(u, v='x')
y <- init(u, v='y')
u <- y * cos(x)
v <- y * sin(x)
field <- stack(u, v)
names(field) <- c('u', 'v')

vectorplot(field, isField='dXY', narrows=5e2)
# Works as expected

# However when the raster is in projected coordinates with high absolute
coordinate values (UTM in m) the arrows disappear or
# are at least infinitely small
projection(field) <- "+proj=utm +zone=32 +datum=WGS84 +units=m +no_defs
+ellps=WGS84 +towgs84=0,0,0"
extent(field) <- c(314420, 314420+1000, 4912697, 4912697+1000)
vectorplot(field, isField='dXY', narrows=5e2)

Is there any way to adjust the length of the arrows (not arrow heads) as
needed?
My plotting script worked fine in this context with a previous rasterVis
version (0.21 I think) so maybe I miss some fundamental changes?

Best regards,
André



More information about the R-sig-Geo mailing list