[R-sig-Geo] Colouring maps so that adjacent polygons differ in colour

Barry Rowlingson b.rowlingson at lancaster.ac.uk
Tue Apr 5 16:24:30 CEST 2011


On Tue, Apr 5, 2011 at 3:13 PM, Mathieu Rajerison
<mathieu.rajerison at gmail.com> wrote:
> I don't know how to accomplish that in R, but in QGIS, you can use the
> Topocolours plugin to accomplish that.

 topocolours (I wrote that!) uses the same greedy algorithm once its
worked out the connectivity. I did make topocolours have the
flexibility to choose other algorithms but only implemented the greedy
one. The problem with real world maps is that some features have more
than one polygon (islands) and if you want them all coloured the same
you might not be able to do a 4-colour colouring!

 I also used ColorBrewer colours!

 It might be worth taking out the construction of the adjacency list
to another function, since I found recently that poly2nb gave very
different adjacencies to functions in rgeos.

Barry



More information about the R-sig-Geo mailing list