[R-sig-Geo] points on polygons

hadley wickham h.wickham at gmail.com
Thu Oct 16 01:38:09 CEST 2008


On Wed, Oct 15, 2008 at 6:06 PM, Thomas Lumley <tlumley at u.washington.edu> wrote:
>
>
> I am trying to draw a US map with color-coded cities superimposed on
> color-coded states, showing survey results from the Behavioral Risk Factor
> Surveillance System.  You can see the sort of thing I'm trying to do at
> http://apps.nccd.cdc.gov/gisbrfss/select_question.aspx (though I don't want
> all the text).
>
> I have the spatial data, which are a shapefile of polygons for the states,
> and a shapefile of points for the cities.  I can read these in and use
> spplot() and the sp.layout option to get the points plotted on top of the
> polygons, but I can't figure out how to get a common set of colors used for
> both and and a color key drawn.

It's relatively easy to do this with ggplot2 (the tricky part is
converting the polygons to a data frame) - I can provide some code if
you're interested.

Hadley


-- 
http://had.co.nz/




More information about the R-sig-Geo mailing list