Introduction

For this project, I will create a data driven animation to tell the story about the rise and fall of autocratic ruling parties around the world from 1940-2015.

The dataset has been created by Michael K. Miller, an Associate Professor of Political Science and International Affairs from George Washington University. You can find more about the data here.

# Load Libraries
library(tidyverse)
library(ggmap)
library(maps)
library(ggthemes)
library(gganimate)
library(viridis)

Data Preparation

The Autocratic Ruling Parties Dataset (ARPD) includes a range of variables for all autocratic ruling parties in the world from 1940-2015. The data covers 479 total autocratic regime spells. This corresponds to 156 countries (including microstates) and 133 countries with at least one ruling party spell.

# Load dataset
data <- read.table("https://raw.githubusercontent.com/saayedalam/Data/master/AutocraticRulingPartiesDataset_cy.txt")
dim(data)
## [1] 6536   40

Overview And Sample

The following excerpts from the author of the dataset eloquently and elaborately describe the nature of this dataset:

The sample includes any ruling party that had power between 1940 and 2015 within an autocracy, with autocracy defined using Boix et al.’s (2013) most recent update. A ruling party is defined as a political party that is either the supreme ruling power or is used as a significant vehicle of power by the regime and is clearly preeminent among all parties. Where there is any ambiguity, special attention is placed on parties of the executive. The sample therefore includes military regimes, monarchies, and personalistic regimes, as long as the rulers rely to a meaningful degree on a specific party. Cases where there are multiple parties in a legislature or lower-level government, fluid competition, and little to no reliance on parties by a monarch or military dictator (e.g., modern Morocco, Japan in the 1930s) are not included. Parties founded to compete in democratizing elections and parties of the executive in caretaker governments before a democratic transition are also not counted.

The dataset tracks continuous party spells in power. A breakdown is recorded if there is a transfer of power to a distinct party, a transition to a non-party autocratic regime, or democratization. Major splits and mergers are treated as breakdowns, but not changes in name, policy, or when a ruling party absorbs a small party without fundamental change (e.g., the Workers’ Party of North Korea’s merger with its outlawed South Korean sibling in 1949). Where any change occurred, the cases were checked to ensure the same organization and power structure remained in place.

Each year in each autocracy is assigned to a ruling party or non-party government. If am transition occurs, the regime at the year’s end is generally applied to that year. However, if a party gains power, rules for most of the year, then loses power before the year’s end, the year is assigned to that party to avoid omitting it entirely. In addition, if a party loses power and there’s a short non-party transitional spell crossing into the following year, the year is assigned to the party rather than a non-party interruption. Autocratic years without a party are included with missing values for party characteristics and indicators for the predominant form of regime during the period.

set.seed(123)
data %>% 
  sample_n(5)
##     Country ccode Year Party_Regime
## 1  Ethiopia   530 1952            0
## 2 Singapore   830 1969            1
## 3      Iran   630 2015            0
## 4      Togo   461 1989            1
## 5      USSR   364 1985            1
##                                                                Party
## 1                                                                  N
## 2                                              People's Action Party
## 3                                                                  N
## 4 Rally of the Togolese People (RPT) / Union for the Republic (UNIR)
## 5                                Communist Party of the Soviet Union
##   Year_Founded Party_Age Year_in_Power Last_Year_of_Power Power_Change
## 1           NA        NA          1941               1978            0
## 2         1954        15          1965                  N            0
## 3           NA        NA          1988                  N            0
## 4         1969        20          1969                  N            0
## 5         1912        73          1922               1991            0
##   Competition           Origin How_Power_Gained    How_Power_Ended
## 1          NA             <NA>             <NA>               <NA>
## 2           1     Independence         Election                N/A
## 3          NA             <NA>             <NA>               <NA>
## 4           0 Dictator-Created Dictator-Created                N/A
## 5           0        Communist       Revolution Dictator-Supported
##   Democracy_Year_After Accession_to_Democracy Power_from_Independence Renaming
## 1                    0                      0                      NA     <NA>
## 2                    0                      0                       1     <NA>
## 3                    0                      0                      NA     <NA>
## 4                    0                      0                       0     2012
## 5                    1                      1                       0     <NA>
##   Evolution Marxist Military Monarchy Violence Occupation Compet_Auth
## 1        NA      NA        1        1        0          0           0
## 2         0       0        0        0        0          0           0
## 3        NA      NA        0        0        0          0           1
## 4         0       0        0        0        0          0           0
## 5         0       1        0        0        0          0           0
##                 Compet_Parties Last_Before_Dem Next_Dem_Year Dem_Remains
## 1                         <NA>              NA            NA          NA
## 2                         <NA>              NA            NA          NA
## 3 Combatant Clergy Association              NA            NA          NA
## 4                         <NA>              NA            NA          NA
## 5                         <NA>              NA            NA          NA
##   Dem_Competitive Dem_Power Dem_Remains_Any Dem_Competitive_Any Dem_Power_Any
## 1              NA        NA              NA                  NA            NA
## 2              NA        NA              NA                  NA            NA
## 3              NA        NA              NA                  NA            NA
## 4              NA        NA              NA                  NA            NA
## 5              NA        NA              NA                  NA            NA
##   Dem_Years_Remains Dem_Years_Competitive Dem_Years_Power Military_Ally
## 1              <NA>                  <NA>            <NA>            NA
## 2              <NA>                  <NA>            <NA>            NA
## 3              <NA>                  <NA>            <NA>            NA
## 4              <NA>                  <NA>            <NA>            NA
## 5              <NA>                  <NA>            <NA>            NA
##   Governance Favors_Ethnic
## 1       <NA>            NA
## 2       <NA>            NA
## 3       <NA>            NA
## 4       <NA>            NA
## 5       <NA>            NA

Now that we understand the dataset, I will clean and transform the data according to the goal of this project. The goal is to show change in the number of autocratic regimes around the world over time.

  • First, I will filter the dataset using the Party_Regime variable. This variable is 1 if the country has an autocratic ruling party and 0 otherwise.
  • Next, I only select the variables Country and Year and add the number of parties per country per year.
  • Then, using the ggmap package and Google Map API (API is hidden due to security. Read More), I extract the geolocation of all the countries.
  • Finally, I join the dataset and print the first 5 rows of the clean dataset.
dt <- data %>% 
  filter(Party_Regime == 1) %>%
  select(Country, Year) %>% 
  add_count(Year, name = "Party_Per_Year") %>% 
  mutate(Year = as.factor(Year))

longlat <- dt %>%
  distinct(Country) %>% 
  mutate(Country = as.character(Country)) %>% 
  mutate_geocode(Country)

dt <- longlat %>% 
  right_join(dt)

head(dt)
## # A tibble: 6 x 5
##   Country       lon   lat Year  Party_Per_Year
##   <chr>       <dbl> <dbl> <fct>          <int>
## 1 Afghanistan  67.7  33.9 1974              64
## 2 Afghanistan  67.7  33.9 1975              70
## 3 Afghanistan  67.7  33.9 1976              72
## 4 Afghanistan  67.7  33.9 1977              73
## 5 Afghanistan  67.7  33.9 1978              75
## 6 Afghanistan  67.7  33.9 1979              75

Data Visualization

Now that we have a clean dataset, it is time to visualize. First, I will create a layer of map borders using ggplot2 package.

world <- ggplot() +
  borders("world", colour = "#81cffc", fill = "#b3e3ff") +
  theme_map()

world

Next, I overlay the data points i.e. the number of parties per country. I use the virdis package to visualize the continuous variable of the number of parties.

map <- world +
  geom_point(aes(x = lon, y = lat, colour = Party_Per_Year), data = dt, size = 7) +
  scale_color_viridis() +
  theme(legend.position = 'right') +
  labs(title = "Autocratic Party Regimes", subtitle = "1940-2015", colour = "Number of Parties")

map

Animation

Finally, I animate the static graph in order to show the change in the number of parties from 1940 to 2015.

anime <- map +
  labs(subtitle = "Year: {frame_time}") +
  transition_time(as.integer(as.character(dt$Year))) +
  shadow_wake(wake_length = 0.1) +
  enter_grow() +
  exit_shrink()

anime 

Conclusion

The purpose of this data visualization project was to utilize animation techniques to tell the story of the rise and fall of autocratic regimes party. The animation tells us the rise of autocratic regimes started in Africa and parts of Europe and Asia in small numbers. Then we see parties showing up in parts of Central America and other parts of the American continents. We also see the highest number of parties in 1980s around the world. Finally, the parties started to disappear in the beginning of 21st century, first from Western hemisphere and then Europe. With some remaining in parts of Africa and Asia.