2018-10-27

Overview

This presentation shows data about the population of the 5 major Apulian cities, gathered from demographic census every 10 years from 1911 to 2011. Data were scraped from Wikipedia.

Demographic census events in Italy usually take place every 10 years on the year ending in 1, with the exceptions of 1936, when a 5-year census programme was proposed but then abandoned, and 1941, when it wasn't performed due to war-related reasons.
For the sake of visualization, however, I annotated the 1936 values as belonging to 1941.

Input data

Let's first load the required packages.

library(tidyverse)
library(plotly)

The code to create the population dataframe is not included here because it would not fit well in the presentation. It is available at this link, if you are interested.

Plot draft

Let's first create a ggplot2 visualization.

g <- df %>% 
    ggplot(aes(x = Year, y = Population, color = City)) + 
    geom_line() + 
    scale_y_continuous(breaks = c(100000, 200000, 300000), 
                       labels = c("100", "200", "300")) + 
    scale_x_continuous(breaks = c(1911, 1921, 1931, 1941, 1951, 
                                  1961, 1971, 1981, 1991, 2001, 
                                  2011)) + 
    labs(y = "Population (thousands)", 
         title = "Population in Apulian cities 1911-2011")

Now we can convert this plot to Plotly and show it.

Plot

ggplotly(g)