Mireille Raad's blog
Goofy things, code, data, unfamiliar ideas and stuff worth sharing.
home / blog / datacode
Population Pyramids in Lebanon and the MENA region

Thanks to Twitter, I stumbled upon the Population Pyramid website.

Population distribution - for gender and age - can be fascinating and telling. (The reasons are many, maybe that’s a topic for another post).

I manually downloaded images for different years. Eventually I wanted to visualize the changes by creating an animated GIF. I noticed that the url for “download image” encodes the name of the country and the year, so I wrote this bash script to get the images and create the animation.

for i in `seq 1950 2018`;
    wget "https://images.populationpyramid.net/capture/?selector=%23pyramid-share-container&url=https%3A%2F%2Fwww.populationpyramid.net%2Fworld%2F"$i"%2F%3Fshare%3Dtrue" -O $i".png"
echo images downloaded

convert -delay 35 -loop 0   *.png animated.gif

** Basically I run wget to save the files locally and convert to take the png list and create a gif.

Here is the population distribution of the world in 1950 and 2018.

World Population 1950

World Population 2018

The animated version is much more fun

World Population 1950-2018

Since I am from Lebanon, I was interested in my country’s data. Here are the graphs for 1950 and 2018.

Lebanon Population 1950

Lebanon Population 2018

Here is the GIF. As a background, Lebanon’s civil war was from 1975 to 1990.

Lebanon Population 1950-2018

I found Lebanon’s pyramid in 1957 to be pretty crazy. The population was 1.6 Millions, with a huge portion of the population being kids. I wondered if there was a glitch in the data.

Lebanon in 1957

Neighboring countries

Here are the exported images for some neighboring countries. I arranged them from the “youngest” to the “more evenly distributed”. Lebanon comes at the bottom of the list. Only UAE, Qatar and Bahrain have less new borns than Lebanon. Some countries in the Gulf have such a weird gender distribution… the more you scroll, the weirder it gets.

Palestine Palestine - 7.6

Yemen Yemen - 7.3

Egypt Egypt - 6.8

Jordan Jordan - 6.4

Algeria Algeria - 5.7

Syria Syria - 5.6

Morocco Morocco - 5.0

Libya Libya - 4.9

Saudi Arabia Saudi Arabia - 4.8

Kuwait Kuwait - 4.

Oman Oman - 4.5

Tunisia Tunisia - 4.5

Iran Iran - 4.2

Bahrain Bahrain - 3.8

Qatar Qatar - 3.0

United Arab Emirates UAE - 2.6

You can download and create GIFs for the country that you want by re-using the script. I didn’t create and add all the GIFs because it will become too dizzying to look at.

If you can’t get it to work, chat with me on @migheille and I will probably do it for you.