since each county gets a single color, you would need to combine two color schemes. I am skeptical that this will work well, but you could try using rgb(). For example - code one variable using the red component, the other using the blue component.
albyn On Wed, Dec 07, 2011 at 11:14:27PM -0500, bby2...@columbia.edu wrote: > Hi David, > > Sorry it sounds vague. > > Here is my current code, which gives the distribution of family size > at US county level. You will see on a US map family size > distribution represented by different colors. > > Now if i have another variable income, which has 3 categories(<50k, > 50k-80k,>80k). How do I show 5x3 categories on the map? I guess I > could always create a third variable to do this. Just wondering > maybe there is a function to do this readily? > > Thank you! > Bonnie Yuan > > y=data1$size > x11() > hist(y,nclass=15) # histogram of y > fivenum(y) > # specify the cut-off point of y > y.colorBuckets=as.numeric(cut(y, c(1,2, 3,6))) > # legend showing the cut-off points. > legend.txt=c("0-1","1-2","2-3","3-6",">6") > colorsmatched=y.colorBuckets[match(county.fips$fips,fips[,1])] > x11() > map("county", col = colors[colorsmatched], fill = TRUE, resolution = 0) > map("state", col = "white", fill = FALSE, add = TRUE, lty = 1, lwd = 0.2) > title("Family Size") > legend("bottom", legend.txt, horiz = TRUE, fill = colors, cex=0.7) > > > > Quoting David Winsemius <dwinsem...@comcast.net>: > > > > >On Dec 7, 2011, at 6:12 PM, bby2...@columbia.edu wrote: > > > >>Hi, I just started playing with county FIPS feature in maps > >>package which allows geospatial visualization of variables on > >>US county level. Pretty cool. > > > >Got code? > > > >> > >>I did some search but couldn't find answer to this question--how > >>can I map more than 2 variables on US map? > > > >"2 variables" is a bit on the vague side for programming purposes. > > > >>For example, you can map by the breakdown of income or family > >>size. How do you further breakdown based on the values of both > >>variables and show them on the county FIPS level? > > > >"breakdown" suggests a factor construct. If so, then : > > > >?interaction > > > >But the "show" part of the question remains very vague. > > > > Can't you be a bit more specific? What DO you want? > > > >-- > >David Winsemius, MD > >West Hartford, CT > > ______________________________________________ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > -- Albyn Jones Reed College jo...@reed.edu ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.