Figure Democratizations

a small figure from the dataset showing the number of democratization events in a given year

Imports

library(tidyverse)
library(plotly)
df <- haven::read_dta("data/DDCGdata.dta")

Clean and build data

d_df <- df %>% 
  select(year, yeardem) %>% #filter columns year and indicator of democratization
  filter(yeardem == 1) %>% #filter out democratization events
  group_by(year) %>% #group by year
  summarise(count = n()) #count number of events in a given year

Plot

fig <- ggplot(d_df, aes(x = year, y = count)) +
  geom_col() + # add line
  labs(x = "Year", y = "Number of Democratization Events") +
  theme_classic()  + 
  theme(panel.grid.major.y = element_line(color = "lightgray"))

Save the Figure and preview the Figure (interactive with ggplotly())

ggsave("output/figureDem.png", fig, width = 10, height = 4, dpi = 300)
ggplotly(fig)