Skip to content
Prev 221167 / 398500 Next

help color coding map in R

Sorry, I was talking nonsense.

The actual problem was in your panel function, where you extract the
state boundaries, and then draw them using panel.polygon: the order of
states from map() is arbitrary, and does not correspond to the color
palette that you set up.

I suggest using mapplot(). This matches the region names you provide
to the names from the map.  However (as in your original case) you do
need to ensure that they match exactly, including case and sub-region
names...

i.e. you need to match up
    NatSTSummaryHigh.abi$JurisdtnStateName  with
    map("state", regions=NatSTSummaryHigh.abi$JurisdtnStateName)$names
(exactly).


nclr <- 4
plotclr <- brewer.pal(nclr,"PuRd")
class <- classIntervals(NatSTSummaryHigh.abi$STMean, nclr, style="fisher" )

mapplot(tolower(JurisdtnStateName) ~ STMean, data = NatSTSummaryHigh.abi,
    map = us.map, breaks = class$brks, colramp = colorRampPalette(plotclr))


-Felix
On 18 May 2010 02:37, Anderson, Chris <chris.anderson at paradigmcorp.com> wrote:
-- 
Felix Andrews / ???
Postdoctoral Fellow
Integrated Catchment Assessment and Management (iCAM) Centre
Fenner School of Environment and Society [Bldg 48a]
The Australian National University
Canberra ACT 0200 Australia
M: +61 410 400 963
T: + 61 2 6125 4670
E: felix.andrews at anu.edu.au
CRICOS Provider No. 00120C