2016-08-14 21 views
5

मैं संयुक्त राज्य अमेरिका के चोरोप्लेथ मानचित्र को एक विशिष्ट रंग और दुर्भाग्य से प्रारूपित करने की कोशिश कर रहा हूं, रंग बदलने के लिए scale_fill_brewer का उपयोग करते समय; राज्यों में से केवल 48 (हवाई और अलास्का नहीं करते हैं)। क्या यह जानना संभव है कि क्या मैं हवाई और अलास्का के रंग को भी लागू कर सकता हूं?अलास्का और हवाई काउंटी चोरोप्लेथ मानचित्र के लिए सही ढंग से प्रारूपण नहीं कर रहे हैं R

library(choroplethr) 
library(choroplethrMaps) 
library(ggplot2) 
data(df_pop_county) 

county_choropleth(df_pop_county, title = "Title1", legend = "Top 20% of Index", num_colors = 9) + 

geom_polygon(aes(fill=value), color="white") + 

scale_fill_brewer(name="Top Index", palette="YlOrRd") 

उत्तर

4

इस विकल्प का उपयोग करने के लिए और इस प्रकार यह ठीक से सभी राज्यों में हम कर सकते work with it as an R6 object अद्यतन किया है:

library(choroplethr) 
library(choroplethrMaps) 
library(ggplot2) 
data(df_pop_county) 

choro    = CountyChoropleth$new(df_pop_county) 
choro$title  = "2012 Population Estimates" 
choro$ggplot_scale = scale_fill_brewer(name="Population", palette=2, drop=FALSE) 
choro$render() 

enter image description here

विशेष चटाई आप का उल्लेख का उपयोग करना:

choro    = CountyChoropleth$new(df_pop_county) 
choro$title  = "2012 Population Estimates" 
choro$ggplot_scale = scale_fill_brewer(name="Population", palette="YlOrRd", drop=FALSE) 
choro$render() 

enter image description here

संबंधित मुद्दे

 संबंधित मुद्दे