World Map Visualizations Based on Data in R

I am working on a workshop for Business Analytics masters students. Part of the demos I intend to use are geographical visualizations. I am using rworldmap package to achieve these.

Let us say you have geographical data in a data.frame such as country, with country identifiers stored in “ip_iso2” column in ISO2 format and the variable of interest in “Supply” column. You plot this data as:

# Convert your data to a map that rworldmap can render country
country<- joinCountryData2Map(country, joinCode = "ISO2", nameJoinColumn = 'ip_iso2', verbose = T)
# Render the map
mapCountryData(country, nameColumnToPlot = "Supply")

Result would looke like this:


A fancier example would be having a third grouping variable such as “Those” in a column.

# Initialize the map
# Populate the map(, and change colors of land and oceans)
mapBubbles(dF=country, nameZSize="Supply", nameZColour="Those", colourPalette="rainbow", oceanCol="lightblue", landCol="wheat")

And this would be the result of this effort.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Create a website or blog at

Up ↑

%d bloggers like this: