Last active
January 19, 2018 12:06
-
-
Save chrissyhroberts/68dd4e42298d69af77a388aa3475a9bc to your computer and use it in GitHub Desktop.
World map colour by country name
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(rworldmap) | |
theCountries<-read.table("Countries.txt",header=T,sep="\t") | |
# These are the ISO3 names of the countries you'd like to plot in red | |
malMap <- joinCountryData2Map(theCountries, joinCode = "ISO3", | |
nameJoinColumn = "ISO.ALPHA.3.Code") | |
# This will join your malDF data.frame to the country map data | |
summary(factor(theCountries$ODK.project)) | |
mapCountryData(malMap, nameColumnToPlot="ODK.project", catMethod = "categorical", | |
missingCountryCol = gray(.8),addLegend = F,borderCol = T,mapTitle = NULL) | |
# And this will plot it, with the trick that the color palette's first | |
# color is red | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment