In [ ]:
from __future__ import division
%matplotlib inline
#import nds2
import numpy as np
import matplotlib.pyplot as plt
plt.style.use('bmh')
#import matplotlib.mlab as mlab
#import scipy.signal as sig
import scipy.constants as const
from matplotlib.ticker import StrMethodFormatter, NullFormatter
import pandas as pd
#from matplotlib import rc
#rc('font',**{'family':'sans-serif','sans-serif':['Helvetica']})
## for Palatino and other serif fonts use:
plt.rcParams['font.family'] = 'Palatino'
plt.rcParams['font.size'] = 18
plt.rcParams['axes.labelsize'] = plt.rcParams['font.size']
plt.rcParams['axes.titlesize'] = 1.5*plt.rcParams['font.size']
plt.rcParams['legend.fontsize'] = plt.rcParams['font.size']
plt.rcParams['xtick.labelsize'] = plt.rcParams['font.size']
plt.rcParams['ytick.labelsize'] = plt.rcParams['font.size']
#plt.rcParams['savefig.dpi'] = 2*plt.rcParams['savefig.dpi']
#plt.rcParams['xtick.major.size'] = 3
#plt.rcParams['xtick.minor.size'] = 3
#plt.rcParams['xtick.major.width'] = 1
#plt.rcParams['xtick.minor.width'] = 1
#plt.rcParams['ytick.major.size'] = 3
#plt.rcParams['ytick.minor.size'] = 3
#plt.rcParams['ytick.major.width'] = 1
#plt.rcParams['ytick.minor.width'] = 1
plt.rcParams['legend.loc'] = 'best'
#plt.rcParams['axes.linewidth'] = 1
plt.rcParams['text.usetex'] = False
In [ ]:
fname = 'Data/WorldPopulationAnnual12000years_interpolated_HYDEandUNto2015.csv'
# how to fix the date string so that it has 4 digits for the year?
df = pd.read_csv(fname)
#df = df.sort_values(by='Date')
df.head()
In [ ]:
t = df.iloc[:,0]
p = df.iloc[:,1]
#df.plot(y='Physical Science', x='Data')
fig,ax = plt.subplots(1, figsize=(12,8))
ax.semilogy(t, p/1e9, c='xkcd:Indigo', lw=3)
ax.set_xlabel('Time [years AD]')
ax.set_ylabel('Population [billions]')
#ax.yaxis.set_major_formatter(StrMethodFormatter('{x:.2f}'))
plt.title(r'Global Population over time')
plt.show()
In [ ]:
In [ ]:
In [ ]: