[R] plot.Map with pattern instead of colors
Arne Henningsen
ahenningsen at email.uni-kiel.de
Tue Sep 21 10:12:14 CEST 2004
Dear Roger,
thank you for your valuable hints regarding plot.polylist, Map2poly and
RColorBrewer( , "Greys" ). Adding pattern to some shapes with
plot( Map2poly( x ), density = myDensities, add = TRUE ) works great!
Best wishes,
Arne
On Monday 20 September 2004 14:20, Roger Bivand wrote:
> 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:
>
> library(RColorBrewer)
> 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
--
Arne Henningsen
Department of Agricultural Economics
University of Kiel
Olshausenstr. 40
D-24098 Kiel (Germany)
Tel: +49-431-880 4445
Fax: +49-431-880 1397
ahenningsen at agric-econ.uni-kiel.de
http://www.uni-kiel.de/agrarpol/ahenningsen/
More information about the R-help
mailing list