[R-sig-Geo] symbols in spplot

piero campa piero.campa at gmail.com
Thu Sep 22 15:04:08 CEST 2011


Dear all,
I would like to share a function that, as suggested by Roger, displays
arrows as SpatialLinesDataFrame objects that can be plotted with the spplot
command.

Little reproducible example:
> # Setup
> data(meuse)
> data(meuse.grid)
> attach(meuse)
> coordinates(meuse) <- ~x+y
> coordinates(meuse.grid) <- ~x+y
> proj4string(meuse) <- CRS("+init=epsg:28992")
> proj4string(meuse.grid) <- CRS("+init=epsg:28992")
> gridded(meuse.grid) <- TRUE
> # Create Arrows and plot
> myArrows <- spatial_arrows(zinc, copper, coordinates(meuse),
> proj4string(meuse), max.length=300, min.length=50, do.sqrt=FALSE)
> spplot(meuse.grid, zcol="dist", sp.layout=list("sp.lines", myArrows),
> main="Arrows Example with spplot", scales=list(draw=TRUE))

I upload the funcion and a the picture yielded by this example:
http://r-sig-geo.2731867.n2.nabble.com/file/n6820092/spatial_arrows.R
spatial_arrows.R 
http://r-sig-geo.2731867.n2.nabble.com/file/n6820092/meuse.arrows.png
meuse.arrows.png 

Hope this helps.
Cheers,
Piero


--
View this message in context: http://r-sig-geo.2731867.n2.nabble.com/symbols-in-spplot-tp2766289p6820092.html
Sent from the R-sig-geo mailing list archive at Nabble.com.



More information about the R-sig-Geo mailing list