Instantly share code, notes, and snippets.

Embed
What would you like to do?
#!/usr/bin/env python3
from ggplot import *
from pandas import DataFrame
data = DataFrame([
{
'year': 1905,
'number': 3039751,
},
{
'year': 1915,
'number': 3479922,
},
{
'year': 1920,
'number': 3955308,
},
{
'year': 1925,
'number': 3993408,
},
{
'year': 1930,
'number': 4592537,
},
{
'year': 1935,
'number': 5212426,
},
{
'year': 1940,
'number': 5872084,
},
{
'year': 1956,
'number': 9367661,
},
{
'year': 1970,
'number': 14769702,
},
{
'year': 1975,
'number': 16279356,
},
{
'year': 1980,
'number': 18029798,
},
{
'year': 1990,
'number': 20393628,
},
{
'year': 2000,
'number': 22300929,
},
{
'year': 2010,
'number': 23123866,
},
])
p = ggplot(data, aes(x='year', y='number/1000000')) + \
ggtitle('Population (Taiwan)') + \
xlab('Year') + \
ylab('People (M)') + \
geom_point() + \
scale_x_continuous(limits=(1900, 2020)) + \
scale_y_continuous(limits=(0, 25)) + \
geom_area(alpha=0.1) + \
theme_xkcd()
p.save('a.png')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment