Comparing the composition of population aged 80 years old and above

Data Input:

USA: 1st April 2010 Census

Italy: EUROSTAT population 1st January 2000-2017

China: 1st November 2010 Census

Personal elaboration of data: 2020 mid year population by sex and age and age-group

Comparing the proportion of population aged 80 and above in different countries.

  • USA

Screenshot 2020-03-23 10.57.20

  • China

CHN_80

  • USA, Italy, and China using Italy’s color palette range:

Regional age-sex composition in Germany by NUTS2 60 to 80+ years old

 

Data source: EUROSTAT, personal elaboration of data. Population by age and sex at 1st of July 2020.

GGplot of COVID-19 cases using Italian Health Ministry data

Screenshot 2020-03-22 at 17.14.33.png

Data link

Order labels (this is according to the total number of cases on the 20th of March:
mydt$ord <- factor(mydt$denominazione_provincia, levels=c( 'Bergamo', 'Brescia', 'Milano', 'Cremona', 'Lodi', 'Pavia', 'Mantova', 'Monza e della Brianza', 'Piacenza', 'Sondrio', 'Varese', 'Lecco', 'In fase di definizione/aggiornamento'))

Graph code:
ggplot(mydt%>% filter(codice_regione =='03'))+ #select one region, in this case Lombardia
geom_bar(stat='identity', aes(x=data, fill=ord, y=totale_casi))+
theme(legend.title = element_blank())+
scale_fill_manual(values=c('#a6cee3', '#1f78b4','#b2df8a', '#33a02c', '#fb9a99', '#e31a1c', '#fdbf6f', '#ff7f00', '#cab2d6', '#6a3d9a', '#ffff99', '#b15928', '##000000', '#f0f0f0'), labels=c( 'Bergamo', 'Brescia', 'Milano', 'Cremona', 'Lodi', 'Pavia', 'Mantova', 'Monza', 'Piacenza', 'Sondrio', 'Varese', 'Lecco', ''))+
theme_economist()+
labs(x = '' , y = 'Total cases')+
theme(legend.title = element_blank())

A function to call ggplot population pyramids in one line

What does it do?

If you have a dataset with several (or all!) countries/ regions/ ages/ etc and you want a short call function to plot without having to modify the ggplot2 code every time (e.g. a certain country for a certain year), here’s a solution.

Just save the r script with the function for the plot and call it when you want to use it:

pyramid_plot.R

The next step will be to use facet_wrap to select sub-national administrative units at once to be compared against the national plots.
Data can be found for Iraq at national level on my github page.

Below is the population pyramid for Iraq in year 2000

IRQ_2000