Reputation: 31
I'd like to let my choroplethr map have a different colored border around one (or several) of my counties.
I can change all the border colors or remove the border lines for all counties, but I can't figure out how to make just one county's border a different color. Sample code:
library(choroplethr)
library(choroplethrMaps)
library(ggplot2)
data(county.regions)
montana.counties<-county.regions[county.regions$state.name=="montana",]
fakedata<-as.data.frame(montana.counties$region)
fakedata$value<-runif(n=56, min=0, max=1)
colnames(fakedata)[1]<-"region"
county_choropleth(fakedata,
state_zoom = c("montana"),
num_colors=1) +
geom_polygon(aes(fill = value), color="black")
As an example, I'd love to be able to make the first county (region 30001) red, but keep the remaining counties' borders black. Does anyone have advice?
Upvotes: 1
Views: 814
Reputation: 31
Ari Lamstein was kind enough to post the answer to my question on another forum. I thought I'd add his reply to this post, since his function is an excellent solution. His response to my question:
I did something similar in my article about the demographics of Ferguson, MO.
http://www.arilamstein.com/blog/2015/07/02/exploring-the-demographics-of-ferguson-missouri/
Can you look at the function highlight_county and tell me if that helps you?
Upvotes: 2