Skip to content

Commit a852c6c

Browse files
committed
ENH: add Tooze graph for Tom's edits
1 parent 02c67ca commit a852c6c

File tree

2 files changed

+48
-15
lines changed

2 files changed

+48
-15
lines changed

lectures/long_run_growth.md

Lines changed: 48 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,23 @@ jupytext:
44
extension: .md
55
format_name: myst
66
format_version: 0.13
7-
jupytext_version: 1.14.4
7+
jupytext_version: 1.14.5
88
kernelspec:
99
display_name: Python 3 (ipykernel)
1010
language: python
1111
name: python3
1212
---
1313

14-
1514
# Economic Growth Evidence
1615

1716
## Overview
1817

1918
Adam Tooze's account of the geopolitical precedents and antecedents of World War I includes a comparison of how Gross National Products of European Great Powers had evolved during the 70 years preceding 1914 (see chapter 1 of {cite}`Tooze_2014`).
2019

20+
```{figure} _static/lecture_specific/long_run_growth/rgdp-2011-y1820to1945-leadingeconomies.png
21+
:width: 75%
22+
```
23+
2124
We construct a version of Tooze's graph later in this lecture.
2225

2326
(An impatient reader can jump ahead and look at figure {numref}`gdp1`.)
@@ -77,7 +80,6 @@ Let's look at how many and which countries are available in this dataset
7780
len(data.country.unique())
7881
```
7982

80-
8183
We can now explore some of the 169 countries that are available.
8284

8385
Let's loop over each country to understand which years are available for each country
@@ -92,7 +94,6 @@ cntry_years = pd.DataFrame(cntry_years, columns=['country', 'Min Year', 'Max Yea
9294
cntry_years
9395
```
9496

95-
9697
Let's now reshape the original data into some convenient variables to enable quicker access to countries time series data.
9798

9899
We can build a useful mapping between country codes and country names in this dataset
@@ -101,7 +102,6 @@ We can build a useful mapping between country codes and country names in this da
101102
code_to_name = data[['countrycode','country']].drop_duplicates().reset_index(drop=True).set_index(['countrycode'])
102103
```
103104

104-
105105
Then we can quickly focus on GDP per capita (gdp)
106106

107107
```{code-cell} ipython3
@@ -121,6 +121,7 @@ We create a color mapping between country codes and colors for consistency
121121

122122
```{code-cell} ipython3
123123
:tags: [hide-input]
124+
124125
country_names = data['countrycode']
125126
126127
# Generate a colormap with the number of colors matching the number of countries
@@ -152,7 +153,6 @@ _ = gdppc[cntry].plot(
152153
color=color_mapping['GBR'])
153154
```
154155

155-
156156
:::{note}
157157
[International Dollars](https://en.wikipedia.org/wiki/International_dollar) are a hypothetical unit of currency that has the same purchasing power parity that the U.S. Dollar has in the United States at any given time. They are also known as Geary–Khamis dollars (GK Dollars).
158158
:::
@@ -184,7 +184,6 @@ ax.set_xlabel('Year')
184184
plt.show()
185185
```
186186

187-
188187
We can now put this into a function to generate plots for a list of countries
189188

190189
```{code-cell} ipython3
@@ -221,7 +220,6 @@ def draw_interp_plots(series, ylabel, xlabel, color_mapping, code_to_name, lw, l
221220
return ax
222221
```
223222

224-
225223
As you can see from this chart, economic growth started in earnest in the 18th century and continued for the next two hundred years.
226224

227225
How does this compare with other countries' growth trajectories?
@@ -294,7 +292,6 @@ draw_events(events, ax)
294292
plt.show()
295293
```
296294

297-
298295
The preceding graph of per capita GDP strikingly reveals how the spread of the industrial revolution has over time gradually lifted the living standards of substantial
299296
groups of people
300297

@@ -423,7 +420,6 @@ draw_events(events, ax)
423420
plt.show()
424421
```
425422

426-
427423
## The industrialized world
428424

429425
Now we'll construct some graphs of interest to geopolitical historians like Adam Tooze.
@@ -457,17 +453,55 @@ mystnb:
457453
fig, ax = plt.subplots(dpi=300)
458454
ax = fig.gca()
459455
cntry = ['CHN', 'SUN', 'JPN', 'GBR', 'USA']
460-
start_year, end_year = (1820, 1940)
456+
start_year, end_year = (1820, 1945)
461457
ax = draw_interp_plots(gdp[cntry].loc[start_year:end_year],
462458
'International $\'s','Year',
463459
color_mapping, code_to_name, 2, False, ax)
464460
```
465461

462+
## Constructing a plot similar to Tooze's
466463

467-
### The modern era (1950 to 2020)
464+
Let's first define a collection of countries that consist of the British Empire (BEM) so we can replicate that element of Tooze's chart.
465+
466+
```{code-cell} ipython3
467+
BEM = ['GBR', 'IND', 'AUS', 'NZL', 'CAN', 'ZAF']
468+
gdp['BEM'] = gdp[BEM].loc[start_year-1:end_year].interpolate(method='index').sum(axis=1) # Interpolate incomplete time-series
469+
```
470+
471+
Let's take a look at the aggregation that represents the British Empire
472+
473+
```{code-cell} ipython3
474+
gdp['BEM'].plot() # The first year is np.nan due to interpolation
475+
```
468476

469-
The following graph displays how quickly China has grown, especially since the late 1970s.
477+
```{code-cell} ipython3
478+
code_to_name
479+
```
470480

481+
```{code-cell} ipython3
482+
# Define colour mapping and name for BEM
483+
color_mapping['BEM'] = color_mapping['GBR'] # Set the color to be the same as Great Britain
484+
# Add British Empire to code_to_name
485+
bem = pd.DataFrame(["British Empire"], index=["BEM"], columns=['country'])
486+
bem.index.name = 'countrycode'
487+
code_to_name = pd.concat([code_to_name, bem])
488+
```
489+
490+
```{code-cell} ipython3
491+
fig, ax = plt.subplots(dpi=300)
492+
ax = fig.gca()
493+
cntry = ['DEU', 'USA', 'SUN', 'BEM', 'FRA', 'JPN']
494+
start_year, end_year = (1821, 1945)
495+
ax = draw_interp_plots(gdp[cntry].loc[start_year:end_year],
496+
'Real GDP in 2011 $\'s','Year',
497+
color_mapping, code_to_name, 2, False, ax)
498+
plt.savefig("./_static/lecture_specific/long_run_growth/rgdp-2011-y1820to1945-leadingeconomies.png")
499+
plt.show()
500+
```
501+
502+
### The modern era (1950 to 2020)
503+
504+
The following graph displays how quickly China has grown, especially since the late 1970s.
471505

472506
```{code-cell} ipython3
473507
---
@@ -484,6 +518,7 @@ ax = draw_interp_plots(gdp[cntry].loc[start_year:end_year],
484518
'International $\'s','Year',
485519
color_mapping, code_to_name, 2, False, ax)
486520
```
521+
487522
It is tempting to compare this graph with figure {numref}`gdp1` that showed the US overtaking the UK near the start of the "American Century", a version of the graph featured in chapter 1 of {cite}`Tooze_2014`.
488523

489524
## Regional analysis
@@ -523,7 +558,6 @@ mystnb:
523558
caption: World GDP per capita
524559
name: world_gdppc
525560
---
526-
527561
fig = plt.figure(dpi=300)
528562
ax = fig.gca()
529563
ax = worldgdppc.plot(
@@ -544,7 +578,6 @@ mystnb:
544578
caption: Regional GDP per capita
545579
name: region_gdppc
546580
---
547-
548581
fig = plt.figure(dpi=300)
549582
ax = fig.gca()
550583
line_styles = ['-', '--', ':', '-.', '.', 'o', '-', '--', '-']

0 commit comments

Comments
 (0)