Visualizing commodity trade in mercury with an interactive 3D globe

It was almost TOO easy.

A data visualization app called Flourish has been getting a bit of buzz recently, so I decided to check it out. I noticed a slick existing template using 3D WebGL for illustrating global trade flows. I have a perfect dataset for that!

Our recently published UN Environment Global Mercury Supply, Trade and Demand Report contains data pulled from the UN Comtrade database on global mercury trade in 2008 and 2015. A few hours of data munging and it was ready to go into the template. Flourish also has a story feature which allows you to walk viewers through an interactive graphic. Sort of like a story map in GIS. Here is the result:

2018-06-27_140608

Click on the image to view the interactive story

A link to the graphic itself (without the story) is here.

One word of caution. No matter how slick a graphic looks and performs, it’s only worth as much as the underlying data. In this case, we know that UN Comtrade data for mercury has some serious flaws, including errors and missed reporting by importing and exporting countries, to say nothing of illegal trade (we discuss these issues in the report). Nevertheless we believe the data is still useful in providing an overview of global trade. But please keep the limitations in mind.

Making an Animated GIF Map to Show Progress of the Adoption of the Minamata Convention

If you’ve been anywhere near the internets recently you know that animated gifs are ubiquitous. Never one to miss a trend, I decided to make an animated gif – of a map of course. Actually, gifs can be a good way to show movement in maps and charts. Here are some nice examples and tips.

The animation shows which countries are Parties to the Minamata Convention. They appear in order of ratification.

minamata large loop

The inspiration and method for this animation came from Alasdair Rae:

Alasdair wrote a useful tutorial on how to use QGIS to create amimated map “geogifs”. I’d been looking for an excuse to play around with QGIS (a free desktop GIS application) for a while. In general I found QGIS quite easy to use and feature-rich. My only complaint is not limited to QGIS but applies to all graphical user interface apps. While they are much easier to get started with, they lack the ability to create a reproducible workflow. If I had to make the map again from another dataset I’d have to remember and recreate all the pointing and clicking I did to make the first map. Whereas with something like R one could write a script and use it to reproduce future maps. But perhaps there are some features in QGIS that I am unaware of that could help with reproduciblity.

Data for the map came from my existing Minamata Convention map on CARTO. I exported the shapefile and used it to create the layers in QGIS. My approach differed a bit from Alasdair’s because in my map not all the polygons are highlighed, only the countries that have ratified.

Incidentally, I was not able to create this animation in CARTO because it only allows animation for points, and I needed to show polygons (country borders).

After exporting 84 frames I used gifmaker.me to make the gif rather than the GIMP or Photoshop. Worked just fine.

A Mixed Media Data Visualization

When I was a kid I would ask my Mom what she wanted for Christmas, and she would usually say, “Don’t buy me anything. I’d prefer if you just make me something instead.”  I’d always think this was strange. Why would she prefer a silly drawing or collage when she could have something nice, shiny, and new from the store?

Now of course I understand the appeal of a handmade creation. There’s something very personal and unique about it. The same appeal can apply to handmade data visualizations too. Here’s one I made to show who brought the most coffee to the office coffee club:

coffee

Now you might think this is silly – which it is – but it really got people’s attention, and now coffee contributions are way up in 2018. So by that metric it’s an effective visualization!

To see some very attractive and very professional handmade data visualizations, check out Adriano Attus’ work for Moda 24

A Dataset of all American and British Bombing Missions in WWII

Sometimes you come across a dataset so interesting you just have to stop everything and visualize it. That’s what happened when I saw a tweet from @JulesGrandin  about the THOR database. THOR stands for Theater History of Operations Reports, and it’s a massive database published by the U.S. Defense Digital Service of all releasable U.S. air operations, including WWI, WWII, and the Korean and Vietnam wars. The data on WWII, which I downloaded, also includes Royal Air Force missions as well as some from the South Africa, Australian, and New Zealand Air Forces.

Here’s an animation (using CARTO) of all 178,263 WWII bombing missions from the database:

And here is a map of all the bombing missions colored by aircraft type. You can clearly see the prevalence of the B17 in the European theater, the B29 in Japan, and the P51 in China. Zoom in and click on the individual points to view other attributes of the bombing missions.

These maps barely scrape the surface of what is possible with this dataset. In addition to aircraft type there are many other attributes, including air force, unit, target type, bomb type, and tonnage of bombs dropped. This page from the Defense Digital Service provides some more interesting tidbits gleaned from the WWII data.

Mercury Arcana

Here’s a little project I created to try out the free online graphic design package Canva. While it won’t replace a full-service tool like Illustrator, Canva makes it very easy to create attractive presentations, posters, and simple infographics. It’s definitely worth a try.

Deadly Swiss Avalanches, in Maps

In my previous post, I explored a dataset on fatal avalanches in Switzerland from the Swiss Institute for Snow and Avalanche Research (SLF). The dataset also contains the location of each avalanche, and here I’ll explore a few ways to show the data geographically.

In the map above, the location and date of each avalanche is used to make a time lapse with CartoDB’s Torque function. Each flashing white marker is one fatal avalanche. Besides the general location of avalanche risk in Switzerland and the seasonal pulsation of events, this map does not convey all that much information. However, I think it is worthwhile because it drives home the sheer number of deadly avalanches – 361 – during this period. We have to keep in mind that each of these flashing markers is a separate tragedy that together represent the loss of  465 lives.

This map shows the geographical distribution of fatal avalanches by the activity or location involved in the accident. As I discussed in the last post, the great majority occurred in open country during recreational activities like backcountry touring or off-piste skiing. The map illustrates that backcountry touring accidents are distributed fairly evening across the high Alps, while off-piste skiing and snowboarding accidents tend to be clustered. Closer inspection reveals that these clusters occur around high mountain lifts, like this, the largest cluster, one on the north slope of Mt. Gele and Mt. Fort near the resort of Verbier:

Screen Shot 2016-04-01 at 9.43.47 PM

This map also lends itself well to exploration. The Open Street Map base has great detail upon zooming, and you can click on each point to get more information about each avalanche, such as elevation, aspect, date, and number of fatalities.

Finally, here’s a heatmap showing the density of fatal avalanches, with red areas having the highest densities. The cantons of Valais (in the southwest) and Grisons (in the east) have the highest concentrations of deadly avalanche accidents. I used a Landsat mosaic as a base map, which allows for comparison of the relationship between terrain and avalanche density.

All avalanche data from WSL Institute for Snow and Avalanche Research SLF, 25 March 2016. Data and code available here. Maps generated using CartoDB.

Deadly Swiss Avalanches, in Charts

Snow-covered mountains are one of the most beautiful sights in nature, but in the wrong circumstances they can kill you. Skiers and other mountain enthusiasts sometimes refer to avalanches as the “white death”, and for good reason. Hundreds die in avalanches every year, and a great deal of effort is spent on trying to understand the factors that cause avalanches in the hope of decreasing this toll.

Located in the Alps and a mecca for winter sports, Switzerland takes avalanches seriously. The Swiss Institute for Snow and Avalanche Research  (SLF) monitors snow conditions, issues warnings, and collects data on avalanches. Their web site is very interesting for those interested in winter sports in the Alps. I find the snow maps particularly useful. But for this post I will use their data on fatal Swiss avalanches in the last 20 years to experiment with different ways to visualize some patterns and relationships.

The dataset includes information on the date, location, elevation, and number of fatalities, in addition to the slope aspect, type of activity involved (e.g. off-piste skiing), and danger level at the time of the avalanche. Over the last 20 years there have been 361 fatal avalanches in Switzerland, for a total of 465 deaths. Most avalanches killed only one victim.

Because I wanted to experiment with radial plots, I’ll focus on the variable of slope aspect in this post. Aspect is the compass direction that a slope faces. In this case we’re looking at the slope where the avalanche occurred. In Switzerland, the majority of avalanches occur slopes facing NW – NE, as you can see from this plot:

rose

The gaps at NNE and NNW are probably artifacts of how the aspect data was reported.

This pattern is common in the temperate latitudes of the northern hemisphere. Avalanches are more common on north-facing slopes because they are more shaded and therefore colder, which allows snowfall to remain unconsolidated for longer. When more snow falls, these unconsolidated layers can act as planes of weakness on which snow above can slide. It’s much more complicated that that, with factors like wind and frost layers coming into play. To learn more about how aspect and avalanches, see here. The pattern is unmistakable, but does it hold all year long? I separated the data by month to find out:

rosefacet

Fatal avalanches occurred in all months, but are much more common December – April

A few interesting insights emerge from this plot. First, February is clearly the most deadly month for avalanches.  In December there are actually quite a few avalanches on SE facing slopes, but by January the predominate direction is centered around NW. In February, and to some extent in March, it changes to N-NE. In April it’s NW again, but by then there are significantly few avalanches. So there are some monthly patterns, but I’m not exactly sure what the explanation is. Of course to really nail this down we’d want to do some statistics as well.

One pattern I expected, but did not see, was a decrease in the dominance of northern aspects later in the spring. I expected this because as the days get longer, the shading effect of north facing slopes decreases. It’s important to remember that these are fatal avalanches, and a dataset of all avalanches would look different. For example there are probably a lot of wet avalanches on southern slopes in the spring. But these are much less dangerous than the slab and dry powder avalanches, and therefore not reflected in the fatality data.

The rose style plots above are useful, but I wanted to try to illustrate more variables at once. So I tried a radial scatter plot:

Fatal Swiss avalanches 1995 - 2016: Slope aspect, elevation, and activity

Click on the image for the interactive Plot.ly version

This plot is similar to the previous ones in that the angular axis represent compass direction (e.g. 90 degrees means an east-facing slope). The radial axis (the distance form the center) represent the elevation where the avalanche occurred. And color represents the type of activity that resulted in the fatality or fatalities. Each point is one avalanche. The data are jittered (random variations in aspect) to minimize overplotting. This is necessary because the aspect data are recorded by compass direction (e.g. NE or ESE). The density of the points clearly illustrates the dominance of north-facing aspects. It’s also clear that most avalanches occur between 2000 and 3000 meters (in fact the mean is 2507 m). In terms of activity, backcountry touring and off-piste skiing and boarding dominate. And avalanches at very high altitudes are mostly associated with backcountry touring, which makes sense, as not many lifts go up above 3000m. Perhaps especially perceptive viewer can make out some other patterns in the relationships between variables, but I can’t. Any thoughts on the usefulness of this plot for the dataset?

Finally, I want to share a couple graphics from SLF (available here). Here is a timeline of avalanche fatalities in Switzerland since 1936:

The average number of deaths per year is 25, but this has decreased a bit in the 20 years. There were also more deaths in buildings and transportation routes prior to about 1985. Presumably improvements in avalanche control and warnings reduced fatalities in those areas. And what happened in the 1950/51 season. That was the infamous Winter of Terror. The next plot shows the distribution of fatalities by the warning level in place when the avalanche occurred:

Interestingly, the great majority of deaths happened when warning levels where moderate or considerable. There were significantly fewer deaths during high or very high warning periods. One reason must be that high/very high warnings don’t occur that frequently, but it’s also likely that skiers and mountaineers exercise greater caution or even stay off the mountain during these exceptionally dangerous times. There’s probably some risk compensation going on here. To really quantify risk, you have to know more than just the number of deaths at a given time or place. You also have to know how many people engaged in activities in avalanche country without dying. One clever approach is to use social media to estimate activity levels, as demonstrated in this paper.

Have fun in the mountains and stay safe!

Data and code from this post available here.

All data from WSL Institute for Snow and Avalanche Research SLF, 25 March 2016

Has Your Country Ratified the Minamata Convention on Mercury?

This map shows the current status of ratifications of the Minamata Convention on Mercury. Although I update it frequently, check mercuryconvention.org for the most recent status. The map also shows countries engaged in Minamata initial assessment (MIA) and artisanal and small-scale  gold mining national action plan (NAP) projects funded by the Global Environment Facility (GEF), along with the implementing agencies. Use the “Visible layers” function on the map to toggle between ratification status, MIAs, and NAPs. The full screen button, located below the zoom controls, is also useful.

Data on ratification and GEF project status from the Interim Secretariat of the Minamata Convention and UNEP. Country boundaries from Natural Earth. Mapping done in CartoDB using Robinson projection.

Showing Refugees Some Love

The terrorist attacks in Paris on November 13 brought renewed attention to the movement of refugees from Syria to the West. Unfortunately, much of this attention has been negative, despite the fact that refugees are fleeing the very brutality that was unleashed on Paris. The rhetoric from the Republican presidential candidates in the U.S. has been particularly vile. However, many people around the world continue to welcome refugees and show compassion. That’s why I made this visualization:

This map shows positive media coverage of refugees over the past 24 hours (updated hourly). Each animated marker represents one positive media mention about refugees in a particular location.

The data comes from GDELT (The Global Database of Events, Language, and Tone). GDELT’s Global Knowledge Graph monitors media in 65 languages around the world and uses algorithms to measure the emotions and tone of the texts. The map shows results on the theme of “refugees” with a tone of greater than two. Tone is the most basic GDELT parameter, and measures how positive or negative a media article is. So, for example, this article about how churches in Kansas and Nebraska are ready to help refugees is included in the dataset.

How I made the map

This map is a nice demonstration of some useful CartoDB features, such as sync tables, animation, and custom map projections.

I used the GDELT Global Knowledge Graph API to pull the data and load it into CartoDB. The exact API call is:

http://api.gdeltproject.org/api/v1/gkg_geojson?QUERY=REFUGEES&TIMESPAN=1440&OUTPUTFIELDS=url,name,tone&OUTPUTTYPE=2

This returns a geojson file with all the results over the last 24 hours tagged with the “refugees” theme. Using CartoDB’s sync tables you can set the data table to update automatically. Mine updates every hour.

I filtered the results to only include articles with a tone score of greater than two (positive coverage), and then used CartoDB’s Torque tool to create the animation with a custom marker (the heart).

The map projection is a modified Bonne, with the standard parallel set to 90 degrees North to make it appear more heart-shaped. Here is a useful tutorial for using different projections in CartoDB.

Inspiration came from this blog post, and this tutorial was very helpful in figuring out how to use the GDELT API. You can access the data from my CartoDB page here and easily create a map of your own.

Illustrating the Arc of European Colonialism Using a Dot Plot

A while back I was thinking about European colonialism and the enormous impact it’s had on world history. Wouldn’t it be nice to have a simple visualization to illustrate colonization and decolonization around the world? It occurred to me that a dumbbell dot plot would work well for this task. Here’s what I came up with:

colonial2

The chart shows the dates of colonization and independence of 100 current nations. The countries are organized into broad regions (Asia, Africa, and the Americas), and sorted by date of independence. Color represents the principal colonial power, generally the occupier for the greatest amount of time.

There are many interesting patterns visible in the chart. For example, you can clearly see Spain’s rapid conquest of Central and South America, and then even more rapid loss of its colonies in the 1820s. The scramble for Africa in the late 19th century stands out well, as does the rapid decolonization phase of the late 1950s through early 1970s.

About the Data

To reduce complexity to a manageable level, I set some limitations on what countries to include. First, the chart shows only those countries victim to Western European colonialism. I don’t include Ottoman, Japanese, Russian, American, or other colonial empires. I also don’t include territories that are still governed by former colonial powers (e.g. Gibraltar). This gets controversial and complicated. Countries that were uninhabited upon discovery by colonial powers are also not included. The same with countries that later gained independence from a post-colonial state (e.g. South Sudan).

The dates of independence come from the CIA World Factbook (here). Dates of colonization were derived by my own research, mostly from Wikipedia country pages. I quickly found that establishing a date of colonization is a somewhat subjective decision. Do you choose the date of first European contact? Formal incorporation of the territory into the colonial empire? For the most part, I chose the date of the first permanent European settlement. Notes on the rationale for the date chosen are include in the data spreadsheet (below). In looking at the chart, it’s important to remember that in many cases colonial subjugation was a long process, moving from initial contact, to trade, conquest, settlement, and incorporation.

Constructing the Plot

I wanted to make this plot using ggplot2 in R, but was not sure about best approach. So I reached out on Twitter to dataviz guru and dot plot enthusiast @evergreendata

The response from the #rstats and dataviz community was extremely constructive and useful. Users  @hrbrmstr@jalapic@ramnath_vaidya, and @plotlygraphs all provided great examples (here, here, here, and here, respectively). In the end, I chose to adapt the approach taken by @jalapic.

A quick note on color: I choose colors from the flags of the principal colonial powers to represent them on the plot (except for the Netherlands for which I picked orange). The idea is to make it easier for the viewer to match the color with the country without having to always go back to the legend. I’d be interested in any reactions to this approach. In general, I’d be thrilled with any feedback on how to make this plot better.

Data and code for the plot:


Country Colonized Independence Region Principal Colonial Power Remarks on independence Remarks on date of colonization
Algeria 1830 1962 Africa France 5 July 1962 (from France) Conquest of Algiers
Angola 1575 1975 Africa Portugal 11 November 1975 (from Portugal)
Antigua and Barbuda 1632 1981 Americas UK 1 November 1981 (from the UK)
Argentina 1542 1816 Americas Spain 9 July 1816 (from Spain) Viceroyalty of Peru
Australia 1788 1901 Asia UK 1 January 1901 (from the federation of UK colonies) Australia Day
Bahrain 1892 1971 Asia UK 15 August 1971 (from the UK)
Barbados 1627 1966 Americas UK 30 November 1966 (from the UK)
Belize 1638 1981 Americas UK 21 September 1981 (from the UK)
Benin 1892 1960 Africa France 1 August 1960 (from France)
Bolivia 1533 1825 Americas Spain 6 August 1825 (from Spain) Conquest of Inca Empire
Botswana 1885 1966 Africa UK 30 September 1966 (from the UK)
Brazil 1534 1822 Americas Portugal 7 September 1822 (from Portugal) Captaincies of Brazil
Brunei 1888 1984 Asia UK 1 January 1984 (from the UK) Treaty of Protection
Burkina Faso 1896 1960 Africa France 5 August 1960 (from France) Become French Protectorate
Burma 1885 1948 Asia UK 4 January 1948 (from the UK) Annexed after Third Anglo-British War
Burundi 1891 1962 Africa Belgium 1 July 1962 (from UN trusteeship under Belgian administration) Originally part of German East Africa
Cambodia 1867 1953 Asia France 9 November 1953 (from France) Originally claimed by Germany
Cameroon 1884 1960 Africa France 1 January 1960 (from French-administered UN trusteeship)
Canada 1534 1867 Americas UK 1 July 1867 (union of British North American colonies); 11 December 1931 (recognized by UK per Statute of Westminster) New France
CAR 1894 1960 Africa France 13 August 1960 (from France) Ubangi-Shari
Chad 1900 1960 Africa France 11 August 1960 (from France) Territoire Militaire des Pays et Protectorats du Tchad�
Chile 1541 1810 Americas Spain 18 September 1810 (from Spain) Santiago founded
Colombia 1510 1810 Americas Spain 20 July 1810 (from Spain) Founding of Santa Mar�a la Antigua del Dari_n
Comoros 1841 1975 Africa France 6 July 1975 (from France)
DRC 1876 1960 Africa Belgium 30 June 1960 (from Belgium) Stanley's first exploration of the Congo
Congo, Republic of the 1880 1960 Africa France 15 August 1960 (from France) Treaty with de Brazza
Costa Rica 1522 1821 Americas Spain 15 September 1821 (from Spain) Arrival of Gil Gonzolez Davila
Cote d'Ivoire 1844 1960 Africa France 7 August 1960 (from France) Establishment of French Protectorate
Cuba 1511 1902 Americas Spain 20 May 1902 (from Spain 10 December 1898; administered by the US from 1898 to 1902); not acknowledged by the Cuban Government as a day of independence First Spanish Settlement
Djibouti 1894 1977 Africa France 27 June 1977 (from France) French Somalialand
Ecuador 1534 1822 Americas Spain 24 May 1822 (from Spain) Conquest of Sebasti�n de Benalc�zar
Egypt 1882 1956 Africa UK 28 February 1922 (from UK protectorate status; the revolution that began on 23 July 1952 led to a republic being declared on 18 June 1953 and all British troops withdrawn on 18 June 1956); note – it was ca. 3200 B.C. that the Two Lands of Upper (southern) and Lower (northern) Egypt were first united politically British occupation
El Salvador 1524 1821 Americas Spain 15 September 1821 (from Spain) Conquest by Pedro de Alvarado
Equatorial Guinea 1844 1968 Africa Spain 12 October 1968 (from Spain) Territorios Espa_oles del Golfo de Guinea
Fiji 1874 1970 Asia UK 10 October 1970 (from the UK) British subjugation
Gabon 1885 1960 Africa France 17 August 1960 (from France) Occupied by France
Gambia, The 1815 1965 Africa UK 18 February 1965 (from the UK) British presence established
Ghana 1612 1957 Africa UK 6 March 1957 (from the UK) Gold coast forts
Grenada 1649 1974 Americas UK 7 February 1974 (from the UK) French found permanent settlement
Guatemala 1524 1821 Americas Spain 15 September 1821 (from Spain) Conquest by Pedro de Alvarado
Guinea-Bissau 1482 1974 Africa Portugal 24 September 1973 (declared); 10 September 1974 (from Portugal) Portuguese gold coast colony
Guinea 1850 1958 Africa France 2 October 1958 (from France) French military penetration in the mid-19th century
Guyana 1616 1966 Americas UK 26 May 1966 (from the UK) Essequebo colony (Durch)
Haiti 1492 1804 Americas France 1 January 1804 (from France) Columbus found La Navidad
Honduras 1524 1821 Americas Spain 15 September 1821 (from Spain) Conquest of Gil Gonz�lez de �vila
Hong Kong 1842 1997 Asia UK none (special administrative region of China) Treaty of Nanking
India 1756 1947 Asia UK 15 August 1947 (from the UK) Company rule by East India Company begins
Indonesia 1602 1949 Asia Netherlands 17 August 1945 (declared) Dutch East India Company Established in 1602
Iraq 1920 1932 Asia UK 3 October 1932 (from League of Nations mandate under British administration); note – on 28 June 2004 the Coalition Provisional Authority transferred sovereignty to the Iraqi Interim Government League of Nations mandate under British administration
Jamaica 1509 1962 Americas UK 6 August 1962 (from the UK) First Spanish settlement
Jordan 1922 1946 Asia UK 25 May 1946 (from League of Nations mandate under British administration) League of Nations mandate under British administration
Kenya 1888 1963 Africa UK 12 December 1963 (from the UK) Imperial British East Africa Company
Kuwait 1899 1961 Asia UK 19 June 1961 (from the UK) British protectorate
Laos 1893 1949 Asia France 19 July 1949 (from France) French protectorate of Laos
Lebanon 1920 1943 Asia France 22 November 1943 (from League of Nations mandate under French administration) League of Nations mandate under French administration
Lesotho 1838 1966 Africa UK 4 October 1966 (from the UK) arrival of Trekboers
Libya 1912 1951 Africa UK 24 December 1951 (from UN trusteeship) Italian North Africa
Macau 1557 1999 Asia Portugal none (special administrative region of China) Portugal settlement
Madagascar 1882 1960 Africa France 26 June 1960 (from France) Malagasy Protectorate
Malawi 1876 1964 Africa UK 6 July 1964 (from the UK) Trading settlement at Blantyre
Malaysia 1511 1957 Asia UK 31 August 1957 (from the UK) Portuguese Malacca
Mali 1880 1960 Africa France 22 September 1960 (from France) French Sudan
Mauritania 1890 1960 Africa France 28 November 1960 (from France) Approximate
Mexico 1519 1821 Americas Spain 16 September 1810 (declared); 27 September 1821 (recognized by Spain) Spanish conquest
Morocco 1884 1956 Africa France 2 March 1956 (from France) First Spanish protectorate
Mozambique 1501 1975 Africa Portugal 25 June 1975 (from Portugal) Captaincy of Sofala
New Zealand 1788 1907 Asia UK 26 September 1907 (from the UK) Colony of New South Wales
Nicaragua 1524 1821 Americas Spain 15 September 1821 (from Spain) First Spanish settlements
Nigeria 1800 1960 Africa UK 1 October 1960 (from the UK)
Niger 1899 1960 Africa France 3 August 1960 (from France) Vouley Chanoine Mission
Oman 1507 1650 Asia Portugal 1650 (expulsion of the Portuguese) Occupation of Muscat
Pakistan 1765 1947 Asia UK 14 August 1947 (from British India) Start of company rule in Indian subcontinent
Papua New Guinea 1884 1975 Asia UK 16 September 1975 (from the Australian-administered UN trusteeship) German New Guinea
Paraguay 1537 1811 Americas Spain 14 May 1811 (from Spain) Founding of Asuncion
Peru 1532 1821 Americas Spain 28 July 1821 (from Spain) Battle of Cajamarca
Philippines 1565 1946 Asia Spain 4 July 1946 (from the US) Miguel Lopez de Legazpi arrives
Qatar 1916 1971 Asia UK 3 September 1971 (from the UK) British protectorate
Rwanda 1884 1962 Africa Belgium 1 July 1962 (from Belgium-administered UN trusteeship) Assigned to German East Africa
Senegal 1677 1960 Africa France 4 April 1960 (from France); note – complete independence achieved upon dissolution of federation with Mali on 20 August 1960 French control
Sierra Leone 1787 1961 Africa UK 27 April 1961 (from the UK) "Province of Freedom"
Solomon Islands 1893 1978 Asia UK 7 July 1978 (from the UK) British protectorate
Somalia 1920 1960 Africa UK 1 July 1960 (from a merger of British Somaliland that became independent from the UK on 26 June 1960 and Italian Somaliland that became independent from the Italian-administered UN trusteeship on 1 July 1960 to form the Somali Republic) Dervish state falls
South Africa 1652 1931 Africa UK 31 May 1910 (Union of South Africa formed from four British colonies: Cape Colony, Natal, Transvaal, and Orange Free State); 31 May 1961 (republic declared); 27 April 1994 (majority rule) Cape Town founded
Sri Lanka 1517 1948 Asia UK 4 February 1948 (from the UK) Portuguese establish Colombo
Sudan 1882 1956 Africa UK 1 January 1956 (from Egypt and the UK) British Occupation
Suriname 1667 1975 Americas Netherlands 25 November 1975 (from the Netherlands) Capture by Dutch
Swaziland 1890 1968 Africa UK 6 September 1968 (from the UK) British, Dutch, Swazi trimviral administration
Syria 1923 1946 Asia France 17 April 1946 (from League of Nations mandate under French administration) League of Nations mandate under French administration
Tanzania 1885 1964 Africa UK 26 April 1964; Tanganyika became independent on 9 December 1961 (from UK-administered UN trusteeship); Zanzibar became independent on 10 December 1963 (from UK); Tanganyika united with Zanzibar on 26 April 1964 to form the United Republic of Tanganyika and Zanzibar; renamed United Republic of Tanzania on 29 October 1964 German East Africa (Zanibar controled by Portuguese in 16th century
Togo 1884 1960 Africa France 27 April 1960 (from French-administered UN trusteeship) German Protectorate
Trinidad and Tobago 1530 1962 Americas UK 31 August 1962 (from the UK) Spanish settlement
Tunisia 1881 1956 Africa France 20 March 1956 (from France) French Invasion
Uganda 1894 1962 Africa UK 9 October 1962 (from the UK) Uganda Protectorate
United Arab Emirates 1820 1971 Asia UK 2 December 1971 (from the UK) Trucial States
United States 1607 1783 Americas UK 4 July 1776 (declared); 3 September 1783 (recognized by Great Britain) Jamestown
Venezuela 1522 1811 Americas Spain 5 July 1811 (from Spain) Settlement of Cumana
Vietnam 1862 1945 Asia France 2 September 1945 (from France) Cochinchina
Yemen 1839 1967 Asia UK 22 May 1990 (Republic of Yemen was established with the merger of the Yemen Arab Republic [Yemen (Sanaa) or North Yemen] and the Marxist-dominated People's Democratic Republic of Yemen [Yemen (Aden) or South Yemen]); note – previously North Yemen became independent in November 1918 (from the Ottoman Empire) and became a republic with the overthrow of the theocratic Imamate in 1962; South Yemen became independent on 30 November 1967 (from the UK) British occupy Aden
Zambia 1798 1964 Africa UK 24 October 1964 (from the UK) Claimed by Portugal
Zimbabwe 1888 1980 Africa UK 18 April 1980 (from the UK) British South Africa Company

view raw
colonial.csv
hosted with ❤ by GitHub

# Dumbell Dot Chart of European Colonialism
library(ggplot2)
library(tidyr)
library(dplyr)
library(scales)
colonial <- read.csv("colonial.csv", stringsAsFactors=FALSE,
col.names = c("country", "colony", "independence", "region", "pcp",
"remarks_ind", "remarks_col"))
df1 <- colonial %>% gather(status,year,2:3)
ind <- df1 %>% filter(status=="independence") %>% arrange(desc(year)) %>% .$country
df1$country <- factor(df1$country, levels=rev(ind))
colonial$country <- factor(colonial$country, levels=rev(ind))
#data frames used for labeling only one of the plot facets
f_labels1 <- data.frame(region = c("Africa", "Americas", "Asia"), label = c("Colonization", "", ""))
f_labels2 <- data.frame(region = c("Africa", "Americas", "Asia"), label = c("Independence", "", ""))
plot <- ggplot() +
geom_segment(data=colonial, aes(x=colony, xend=independence, y=country, yend=country), color="gray77",lwd=1)+
geom_point(data=df1, aes(year, country, group=pcp,color=pcp), size=3) +
scale_color_manual(values=c("#000000", "#318CE7", "#FF6600", "#006600", "#F1BF00", "#CF142B"))+
ggtitle("Five Centuries of Colonialism") +
xlab("") + ylab("") +
facet_grid(region ~ ., scales = "free_y", space = "free_y" ) +
labs(color = "Principal\nColonial\nPower") +
scale_y_discrete(expand = c(0,2))+
geom_text(x = 1880, y = Inf, aes(label = label), data = f_labels1, vjust = 1, size = 3)+
geom_text(x = 1975, y = Inf, aes(label = label), data = f_labels2, vjust = 1, size = 3)+
theme_bw() +
theme(
panel.border = element_blank(),
plot.title = element_text(vjust=1),
panel.grid.major.y = element_line(linetype = "dotted", color = "gray20"),
axis.text.y = element_text(size=rel(.8)),
axis.ticks.y = element_line(color = "gray20", size = rel(.8)),
strip.background = element_rect(fill = NA, size = 0, color = "white", linetype = "blank"),
strip.text = element_text(size = rel(1.33)),
legend.key = element_rect(color = "white", size = 0)
)

view raw
colonial2.R
hosted with ❤ by GitHub