I'm trying to create a colored map that would show the number of students
per state.
My data frame consists of two columns - state and count.
I'm using the following code
library(maps)
map(usa)
library(plotrix)
state.col-color.scale(gre$count,0,0,c(0,1))
map(state,fill=TRUE,col=state.col)
I'm
Here's a bit of a hacky way to do it:
#get the names of each state
state=map('state',plot=F)$names
#set up some random state-color data
cols =
as.data.frame(cbind(state=states,x=sample(1:10,length(states),replace=T)))
#do the plot
map('usa')
for(this_state in state){
-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-
project.org] On Behalf Of Alina Sheyman
Sent: Thursday, February 19, 2009 9:46 AM
To: r-help@r-project.org
Subject: [R] colored maps again
I'm trying to create a colored map that would show the number of
students
per state.
My data
3 matches
Mail list logo