[R] filled.contour - color palette so z=0 ONLY is blue

Peter Dalgaard p.dalgaard at biostat.ku.dk
Mon Jun 7 13:48:33 CEST 2004


Laura Quinn <laura at env.leeds.ac.uk> writes:

> I am trying to create a topographic map of an island - the filled.contour
> function works fine except i am experiencing difficulty trying to
> represent the sea properly. Basically I want the default colour blue for
> any instance where z=0, if I simply use the default topo.color I get
> shades of blue for z values up to 220 metres. Is there a way in which I
> can specify terrain.color for all values of z>0 but blue for z=0 - or is
> there another way of acheiving this simply?

 my.colors <- function(n)c("blue",terrain.colors(n-1))
 data(volcano) 
 filled.contour(volcano, color = my.colors, asp = 1)

You'll probably need to diddle the levels=  setting too.
-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)             FAX: (+45) 35327907




More information about the R-help mailing list