[R] plot.Map with pattern instead of colors

Roger Bivand Roger.Bivand at nhh.no
Mon Sep 20 14:20:58 CEST 2004

On Mon, 20 Sep 2004, Arne Henningsen wrote:

> Hi,
> I am plotting shapefiles with plot.Map (package maptools). So far I use 
> different colors for the shapes depending on the a value that belongs to the 
> shape. Now, I need to produce maps only in black, gray and white for 
> publication. Is it possible to fill shapes with pattern (e.g. hatched) 
> instead of colors? 

Not in plot.Map(). This is supported if you convert the shapefile polygons 
to a polylist object (Map2poly()), then use plot.polylist() - but this may 
not be your choice. Within plot.Map, I would suggest using the 
RColorBrewer package and the sequential "Greys" palette, which 
differentiates five grey colours very well for most media.

If you run this after example(plot.Map), it should illustrate a solution:

pal <- brewer.pal(5, "Greys")
fgs <- pal[findInterval(x$att.data$BIR74, res$breaks, all.inside=TRUE)]
plot(x, fg=fgs)

for the default quantile breaks.

> Details of a simplified example:
> I want to show the percentage change of a variable in a map:
> e.g. following levels
> a) >+10
> b) +5% to +10%
> c) -5% to +5%
> d) -10% to -5%
> e) <-10%
> Now I have following colors
> a) "red"
> b) "orange"
> c) "white"
> d) "greenyellow"
> e) "green3" 
> Printing this on a monochrome printer is - of course - stupid, because levels 
> a) and e) as well as b) and d) have approximately the same grayscale. 
> I could fill a) = black and e) = white, and everything inbetween with an 
> appropriate grayscale, but I prefer to have areas with no change to appear 
> white rather than medium gray. Therefore, I thought of doing following:
> a) black
> b) gray
> c) white
> d) hatched with thin lines
> e) hatched with thick lines (or double-hatched)
> Any hints and ideas are welcome!
> (BTW: I use R 1.9.1 on SuSE Linux 9.0)
> Thanks,
> Arne

Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Breiviksveien 40, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 93 93
e-mail: Roger.Bivand at nhh.no

More information about the R-help mailing list