This is an interactive graph generated using the R plotly library.
library(plotly)
#US Population
state_pop<-data.frame(state.abb,Pop=as.vector(state.x77[,1]))
state_pop$hover<-with(state_pop,paste(state.abb,"<br>","Population:",Pop))
#make state borders red
borders <- list(color=toRGB("red"))
map_options<-list(
scope="usa",
projection=list(type="albers usa"),
showlakes=TRUE,
lakecolor=toRGB("white")
)
plot_ly(state_pop,z=state_pop$Pop,text=state_pop$hover,locations=state_pop$state.abb,type='choropleth',
locationmode="USA-states",color=state_pop$Pop,
colors="Blues",marker=list(line=borders)) %>% layout(title="US Income in 1975",geo=map_options)
# redo with US income
state_income<-data.frame(state.abb,Income=as.vector(state.x77[,2]))
state_income$hover<-with(state_income,paste(state.abb,"<br>","Income:",Income))
#make state borders red
borders <- list(color=toRGB("red"))
map_options<-list(
scope="usa",
projection=list(type="albers usa"),
showlakes=TRUE,
lakecolor=toRGB("white")
)
plot_ly(state_income,z=state_income$Income,text=state_income$hover,locations=state_income$state.abb,type='choropleth',
locationmode="USA-states",color=state_income$Income,
colors="Blues",marker=list(line=borders)) %>% layout(title="US Population in 1975",geo=map_options)