I was looking at the Population Pyramid website – God knows why.
I found the population pyramids fascinating. I downloaded the ones for the arab world since the 1950s. I wrote a script to do it. You can re-use it for downloading data for any country.
Make sure you have wget
installed. If you can’t install it, try using curl
.
|
|
I figured how to build the script by looking at the url of the images. For example, this one.
Here is how the url is structured (it is not pretty):
- https://images.populationpyramid.net/capture/
- ?selector=%23pyramid-share-container
- &url=https%3A%2F%2Fwww.populationpyramid.net%2Fworld%2F2019%2F%3Fshare%3Dtrue
You can replace the year and the location to get the image you need.
After downloading the images, it was easier to visualize the changes by creating an animated GIF. I used ImageMagick and this one-liner.
convert -delay 35 -loop 0 *.png animated.gif
(to install ImageMagick, use brew install imagemagick
)
Images
Here is the population distribution of the world in 1950 and 2018.
The animated version is much more fun
Since I am from Lebanon, I was interested in my country’s data. Here are the graphs for 1950 and 2018.
Here is the GIF. As a background, Lebanon’s civil war was from 1975 to 1990.
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.
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-born babies than Lebanon.
Some countries in the Gulf have such a weird gender distribution… the more you scroll, the weirder it gets.
Data is for year 2019.
Palestine
Yemen
Egypt
Jordan
Algeria
Syria
Morocco
Libya
Saudi Arabia
Kuwait
Oman
Tunisia
Iran
Bahrain
Qatar
United Arab Emirates
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.