On Sun, Jan 17, 2010 at 10:39 PM, Andrew Hunter <ahun...@ucalgary.ca> wrote:

> 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.
>
>
 You want 'col' and not 'fg'. See ?"SpatialPolygonsDataFrame-class" for an
example.

 fg is used for axis and box colours, but plot doesn't draw axes or boxes
for spatial polygons data frames. It should be length-1:

# using data from that help:
 > plot(ex_1.7)
 > axis(1,fg="red")
 > axis(2,fg="blue")

Barry


-- 
blog: http://geospaced.blogspot.com/
web: http://www.maths.lancs.ac.uk/~rowlings
web: http://www.rowlingson.com/
twitter: http://twitter.com/geospacedman
pics: http://www.flickr.com/photos/spacedman

        [[alternative HTML version deleted]]

_______________________________________________
R-sig-Geo mailing list
R-sig-Geo@stat.math.ethz.ch
https://stat.ethz.ch/mailman/listinfo/r-sig-geo

Reply via email to