[R-sig-Geo] Thematic Map

Andrew Hunter ahunter at ucalgary.ca
Sun Jan 17 23:39:55 CET 2010


Hi I am using Waller & Gotways Leukaemia data and am trying to create a plot of county population using RColorBrewer using the following:

plotvar <- NY8$POP8
plotvar <- rank(plotvar)
nclr <- 8
plotclr <- brewer.pal(nclr,"PuOr")
colornum <- cut(plotvar, nclr, labels=FALSE)
colorcode <- plotclr[colornum]
plot(NY8, fg=colorcode)

But get the following error:

> plot(NY8, fg=colorcode)
Error in plot.window(xlim = xlim, ylim = ylim, asp = asp, ...) : 
  graphical parameter "fg" has the wrong length

fg contains 281 color assignments and there are 281 polygons in the NY county data.

Using R v. 2.10.1 for Mac OS
Any guidance would be appreciated.

Regards

Andrew Hunter PEng RPSurv PhD
Assistant Professor
Department of Geomatics Engineering
Schulich School of Engineering
University of Calgary

T: +403.220.7377
F: +403.284.1980
E: ahunter (at) ucalgary (dot) ca
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~



More information about the R-sig-Geo mailing list