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

Jin.Li at ga.gov.au Jin.Li at ga.gov.au
Wed Apr 22 03:49:09 CEST 2009


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.htm
HTH

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/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



More information about the R-sig-Geo mailing list