Jump to content

File:Kuwait-population-pyramid-2017.svg

Page contents not supported in other languages.
This is a file from the Wikimedia Commons
From Wikipedia, the free encyclopedia

Original file (SVG file, nominally 1,080 × 720 pixels, file size: 88 KB)

Summary

Description
English: Population Pyramid of Kuwait in 2017.

Population in thousand.

Data from the United Nations, DESA/Population Division https://esa.un.org/unpd/wpp/DataQuery/

Created with Python and Matplotlib.
Date
Source Own work
Author MagHoxpox

Licensing

I, the copyright holder of this work, hereby publish it under the following license:
w:en:Creative Commons
attribution share alike
This file is licensed under the Creative Commons Attribution-Share Alike 4.0 International license.
You are free:
  • to share – to copy, distribute and transmit the work
  • to remix – to adapt the work
Under the following conditions:
  • attribution – You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
  • share alike – If you remix, transform, or build upon the material, you must distribute your contributions under the same or compatible license as the original.
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import rc

fontsize=24
fontsize_small=16
rc('font', family='sans-serif', serif=['Latin Modern Roman','Palatino'], size=fontsize)
rc('legend', fontsize=fontsize)
rc('axes',   labelsize=fontsize)
rc('xtick',  labelsize=fontsize_small)
rc('ytick',  labelsize=fontsize_small)

female_colour = "#b98acb", "#ccaad9"
male_colour   = "#6ca99b", "#5fc9bb"

female_symbol = ur"$\u2640$"
male_symbol   = ur"$\u2642$"

country = "kuwait"
filename = "%s-population-pyramid-2017-20170902.csv" % country

data   = np.loadtxt(filename, skiprows=5, usecols=(-2,-1), delimiter="\t")
#data /=1.e3
female = data[:,0]
male   = data[:,1]

legend = np.loadtxt(filename, skiprows=5, usecols=(3,), dtype=np.string_, delimiter="\t")
legend[0] = "  %s " % legend[0]
legend[1] = "  %s " % legend[1]

numbers = np.arange(data.shape[0])
x_max = 300

fig, ax = plt.subplots(ncols=2, sharey=True, figsize=(12,8))
plt.subplots_adjust(left=0.03, bottom=0.05, right=0.97, top=0.99, wspace=0.14, hspace=None)

ax[0].barh( numbers[0::2], female[0::2], color=female_colour[0])
ax[0].barh( numbers[1::2], female[1::2], color=female_colour[1])
ax[1].barh( numbers[0::2], male[  0::2], color=male_colour[0])
ax[1].barh( numbers[1::2], male[  1::2], color=male_colour[1])

ax[0].minorticks_on()
ax[1].minorticks_on()

ax[0].set(yticks=numbers+0.3, yticklabels=legend)
ax[0].yaxis.tick_right()
ax[1].yaxis.tick_left()
ax[0].xaxis.tick_bottom()
ax[1].xaxis.tick_bottom()

ax[0].tick_params(axis=u'y', which=u'both',length=0)
ax[1].tick_params(axis=u'y', which=u'both',length=0)

ax[0].set_xlim(0, x_max)
ax[1].set_xlim(0, x_max)
ax[0].invert_xaxis()
ax[0].set_ylim(numbers[0], numbers[-1]+1)

plt.text(-x_max*.692, numbers[-6]-0.8, female_symbol, axes=ax[0], ha='center', fontsize=128, color="#887788")
plt.text( x_max*.55,  numbers[-6], male_symbol, axes=ax[1],   ha='center', fontsize=128, color="#778877")
plt.savefig("%s-population-pyramid-2017.svg" % country)
plt.show()

Captions

Add a one-line explanation of what this file represents

Items portrayed in this file

depicts

2 September 2017

File history

Click on a date/time to view the file as it appeared at that time.

Date/TimeThumbnailDimensionsUserComment
current07:21, 2 September 2017Thumbnail for version as of 07:21, 2 September 20171,080 × 720 (88 KB)MagHoxpoxUser created page with UploadWizard

The following 2 pages use this file:

Global file usage

The following other wikis use this file:

Metadata