[R-sig-Geo] rotate sp.objects in spplot?
Roger Bivand
Roger.Bivand at nhh.no
Wed Sep 28 09:41:30 CEST 2011
On Tue, 27 Sep 2011, Myles Falconer wrote:
> Hi everyone,
>
> Just wondering if anyone knows how to rotate objects in spplot. Using
> the script below, let's say I wanted to rotate the north arrow by 12
> degrees... any ideas? Thanks!
library(maptools)
?elide
So:
arrow = list("SpatialPolygonsRescale", elide(layout.north.arrow(),
rotate=12), offset = c(178750,332500), scale = 400)
looks about OK. Do you know that your data have non-North Northings (I
guess you do!), the presumption in "Spatial" objects is that North is
aligned with the vertical axis?
Roger
>
>
> library(sp)
> library(lattice) # required for trellis.par.set():
> trellis.par.set(sp.theme()) # sets color ramp to bpy.colors()
>
> data(meuse)
> coordinates(meuse)=~x+y
>
> scale = list("SpatialPolygonsRescale", layout.scale.bar(),
> offset = c(178600,332990), scale = 500, fill=c("transparent","black"))
> text1 = list("sp.text", c(178600,333090), "0")
> text2 = list("sp.text", c(179100,333090), "500 m")
> arrow = list("SpatialPolygonsRescale", layout.north.arrow(),
> offset = c(178750,332500), scale = 400)
> ## points plot with scale bar, scale bar text, north arrow and title:
> spplot(meuse, "zinc", do.log=T,
> key.space=list(x=0.1,y=0.93,corner=c(0,1)),
> sp.layout=list(scale,text1,text2,arrow),
> main = "Zinc (top soil)")
>
>
> ___________________________________________
>
> Myles Falconer, Ontario Region Project Biologist,
> Bird Studies Canada,
> 115 Front St., P.O. Box 160,
> Port Rowan, ON
> N0E 1M0 Canada
> Email: mfalconer at birdscanada.org
> Ph: 1-888-448-2473 ext. 165
> Local Ph: 519-586-3531 ext. 165
>
> BSC website: http://www.bsc-eoc.org/
>
--
Roger Bivand
Department of Economics, NHH Norwegian School of Economics,
Helleveien 30, N-5045 Bergen, Norway.
voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: Roger.Bivand at nhh.no
More information about the R-sig-Geo
mailing list