Skip to content

Instantly share code, notes, and snippets.

caluchko / colonial.csv
Last active Oct 31, 2015
Colonialism Dot Chart
View colonial.csv
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)

This hit #rstats today:

Has anyone made a dumbbell dot plot in #rstats, or better yet exported to @plotlygraphs using the API?

— Ken Davis (@ken_mke) October 23, 2015
<script async src="//" charset="utf-8"></script>

So, I figured it was worth a cpl mins to reproduce.

While the US gov did give the data behind the chart it was all the data and a pain to work with so I used WebPlotDigitizer to transcribe the points and then some data wrangling in R to clean it up and make it work well with ggplot2.

It is possible to make the top "dumbbell" legend in ggplot2 (but not by using a guide) and color the "All Metro A

View schoolearnings.csv
### Earnings Dumbbell Chart
schoolearnings <- read.csv("schoolearnings.csv", stringsAsFactors=FALSE)
df <- schoolearnings %>% gather(gender,value,2:3)