[R-sig-Geo] spplot [SEC=UNCLASSIFIED]

Roger Bivand Roger.Bivand at nhh.no
Wed Apr 22 08:51:31 CEST 2009


On Wed, 22 Apr 2009, Michael Sumner wrote:

> Ouch - sorry about that, I should have checked.
>
> I don't know how to set axis labels with spplot I'm afraid.

Something like:

library(maptools)
xx <- readShapeSpatial(system.file("shapes/sids.shp", package="maptools")[1],
  IDvar="FIPSNO", proj4string=CRS("+proj=longlat +ellps=clrk66"))
spplot(xx, c("BIR74", "BIR79"), scales=list(draw=TRUE))

Hope this helps,

Roger

>
> Regards, Mike.
>
>
> ==============Original message text===============
> On Wed, 22 Apr 2009 11:49:09 +1000 Jin.Li at ga.gov.au wrote:
>
> Thank you very much, Mike. That is very helpful. I got the colour I was
> after. My data are in lat/long, when I tried degAxis I got:
>> degAxis(1)
> Error in axis(side, at = at, labels = labels, ...) :
>  plot.new has not been called yet
>> degAxis(2)
> Error in axis(side, at = at, labels = labels, ...) :
>  plot.new has not been called yet
> It seems degAxis is not working with spplot. Any suggestions? Thanks.
> Cheers,
> Jin
>
>
> -----Original Message-----
> From: Michael Sumner [mailto:mdsumner at utas.edu.au]
> Sent: Wednesday, 22 April 2009 11:08
> To: Li Jin
> Cc: r-sig-geo at stat.math.ethz.ch
> Subject: Re: [R-sig-Geo] spplot [SEC=UNCLASSIFIED]
>
> This examples shows the use of colorRampPalette(grDevices) to create a
> color ramp with sp.theme, borrowing from the spplot documentation. See
> colors()[grep("brown", colors())]
> to find the browns R already knows about, or generate your own.
>
>  library(lattice)
>     trellis.par.set(sp.theme(regions = list(col =
> colorRampPalette(c("sandybrown", "brown4")))) )
>
>
>     data(meuse.grid)
>     gridded(meuse.grid)=~x+y
>     meuse.grid$g = factor(sample(letters[1:5], 3103,
> replace=TRUE),levels=letters[1:10])
>     meuse.grid$f = factor(sample(letters[6:10], 3103,
> replace=TRUE),levels=letters[1:10])
>     spplot(meuse.grid, c("f","g"))
>
> If your data are already in latitude/longitude then just type this to add
> the graticule and labels:
>
> degAxis(1)
> degAxis(2)
>
> If your data use a different projection there's an example here that
> transforms lines from lat/lon to the grid, but it would be more work to
> figure out for your case:
>
> http://geography.uoregon.edu/GeogR/examples/maps_examples02.htmHTH
>
> Regards, Mike.
>
> ==============Original message text===============
> On Wed, 22 Apr 2009 10:39:21 +1000 Jin.Li at ga.gov.au wrote:
>
> Dear all,
>
> I am using spplot to generate some maps. The maps produced are beautiful
> as shown by the attached file, but I was wondering if it is possible to
> do the following modifications:
> 1) change the colour to brown, that is a value 0 corresponding to
> blank/white, 100 to brown, values in between to lighter browns, something
> like we can get by brown((0:100)/100); this colour is required for mud by
> my organisation; and
> 2) add lat and long on the axes/borders.
>
> Thanks for your help in advance.
>
> Cheers,
>
> Jin
> _______________________________________
> Jin Li, PhD
> Spatial Modeller/Computational Statistician
> Marine & Coastal Environment
> Geoscience Australia
> GPO Box 378, Canberra, ACT 2601, Australia
>
> Ph: 61 (02) 6249 9899; email: jin.li at ga.gov.au<mailto:jin.li at ga.gov.au>
> _______________________________________
>
>
> ===========End of original message text===========
>
>
>
> If it wasn't backed-up, then it wasn't important. ~ Anon sysadmin
>
> Mike Sumner (Phd. Candidate)
> http://www.antcrc.utas.edu.au/~mdsumner/ http://www.zoo.utas.edu.au/awru/  IASOS/AWRUUniversity of Tasmania
> Private Bag 80
> Hobart Tasmania 7001
> AUSTRALIA
> Email: mdsumner at utas.edu.au
> Phone: 03 6226 1752 (W)
>       0408599921   (M)
> Fax:   03 6226 2745
>
>
>
>
>
>
>
>
> ===========End of original message text===========
>
>
>
> If it wasn't backed-up, then it wasn't important. ~ Anon sysadmin
>
> Mike Sumner (Phd. Candidate)
> http://www.antcrc.utas.edu.au/~mdsumner/ http://www.zoo.utas.edu.au/awru/  IASOS/AWRU
> University of Tasmania
> Private Bag 80
> Hobart Tasmania 7001
> AUSTRALIA
> Email: mdsumner at utas.edu.au
> Phone: 03 6226 1752 (W)
>       0408599921   (M)
> Fax:   03 6226 2745
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>

-- 
Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, 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