An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-sig-geo/attachments/20110927/d71259ea/attachment.pl>
rotate sp.objects in spplot?
4 messages · Myles Falconer, Roger Bivand
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
Thanks very much Roger! Is it possible to also rotate sp.text with elide? Myles -----Original Message----- From: Roger Bivand [mailto:Roger.Bivand at nhh.no] Sent: September-28-11 3:42 AM To: Myles Falconer Cc: 'r-sig-geo at r-project.org' Subject: Re: [R-sig-Geo] rotate sp.objects in spplot?
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
On Wed, 28 Sep 2011, Myles Falconer wrote:
Thanks very much Roger! Is it possible to also rotate sp.text with elide?
No, but you could check the rotation parameters for the underlying
graphics method, which seem to be srt=:
text1 = list("sp.text", c(178600,333090), "0", srt=-12)
Roger
Myles -----Original Message----- From: Roger Bivand [mailto:Roger.Bivand at nhh.no] Sent: September-28-11 3:42 AM To: Myles Falconer Cc: 'r-sig-geo at r-project.org' Subject: Re: [R-sig-Geo] rotate sp.objects in spplot? 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
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