@@ -187,7 +187,7 @@ def draw_interp_plots(series, xlabel, ylabel, color_mapping, code_to_name, lw, l
187187
188188 for i, c in enumerate(cntry):
189189
190- df_interpolated = series[c].interpolate()
190+ df_interpolated = series[c].interpolate(limit_area='inside' )
191191 interpolated_data = df_interpolated[series[c].isnull()]
192192 ax.plot(interpolated_data,
193193 linestyle='--',
@@ -205,7 +205,7 @@ def draw_interp_plots(series, xlabel, ylabel, color_mapping, code_to_name, lw, l
205205 if logscale == True:
206206 ax.set_yscale('log')
207207
208- ax.legend(loc='lower center', ncol=3 , bbox_to_anchor=[0.5, -0.25])
208+ ax.legend(loc='lower center', ncol=5 , bbox_to_anchor=[0.5, -0.25])
209209 ax.set_xlabel(xlabel)
210210 ax.set_ylabel(ylabel)
211211
@@ -220,7 +220,9 @@ def draw_interp_plots(series, xlabel, ylabel, color_mapping, code_to_name, lw, l
220220
221221As you can see from this chart economic growth started in earnest in the 18th Century and continued for the next two hundred years.
222222
223- How does this compare with other countries growth trajectories? Let's look at the United States (USA), United Kingdom (GBR), and China (CHN)
223+ How does this compare with other countries growth trajectories?
224+
225+ Let's look at the United States (USA), United Kingdom (GBR), and China (CHN)
224226
225227``` {code-cell} ipython3
226228fig, ax = plt.subplots(dpi=300)
@@ -233,6 +235,7 @@ ax = draw_interp_plots(gdppc[cntry].loc[1200:],
233235b_params = {'color':'grey', 'alpha': 0.2}
234236t_params = {'fontsize': 5,
235237 'va':'center', 'ha':'center'}
238+
236239ylim = ax.get_ylim()[1]
237240ax.text(1320, ylim + ylim*0.2,
238241 'the Great Famine\n(1315-1321)',
@@ -299,6 +302,7 @@ b_params = {'color':'grey', 'alpha': 0.2}
299302t_params = {'fontsize': 5,
300303 'va':'center', 'ha':'center'}
301304ylim = ax.get_ylim()[1]
305+
302306ax.text(1320, ylim + ylim*0.03,
303307 'the Great Famine\n(1315-1321)',
304308 color=color_mapping['GBR'], **t_params)
@@ -319,11 +323,11 @@ ax.text(1849, ylim + ylim*0.13,
319323 color=color_mapping['GBR'], **t_params)
320324ax.axvspan(1848, 1850, color=color_mapping['GBR'], alpha=0.2)
321325
322- ax.text(1665 , ylim + ylim*0.08,
326+ ax.text(1670 , ylim + ylim*0.08,
323327 'Closed-door Policy\n(1655-1684)',
324328 color=color_mapping['CHN'], **t_params)
325-
326329ax.axvspan(1655, 1684, color=color_mapping['CHN'], alpha=0.2)
330+
327331ax.text(1800, ylim + ylim*0.08,
328332 'Industrial Revolution\n(1740-1860)',
329333 color='grey', **t_params)
@@ -344,13 +348,129 @@ ax.text(1978, ylim + ylim*0.08,
344348 color=color_mapping['CHN'], **t_params)
345349ax.axvspan(1978, 1979, color=color_mapping['CHN'], alpha=0.2)
346350
351+ plt.show()
352+ ```
353+
354+ Looking at China GDP per capita levels from 1500 through to the 1970's showed a long period of declining GDP per capital levels from 1700's to early 20th century. (Closed Border / Inward Looking Domestic Focused Policies?)
355+
356+ ``` {code-cell} ipython3
357+ fig, ax = plt.subplots(dpi=300)
358+
359+ cntry = ['CHN']
360+ ax = draw_interp_plots(gdppc[cntry].loc[1600:2000],
361+ 'International $\'s','Year',
362+ color_mapping, code_to_name, 2, True, ax)
363+
364+ ylim = ax.get_ylim()[1]
365+ ax.text(1670, ylim + ylim*0.05,
366+ 'Closed-door Policy\n(1655-1684)',
367+ color='tab:orange', **t_params)
368+ ax.axvspan(1655, 1684, color='tab:orange', alpha=0.2)
369+
370+ ax.text(1800, ylim + ylim*0.05,
371+ 'Industrial Revolution\n(1740-1860)',
372+ color='grey', **t_params)
373+ ax.axvspan(1760, 1840, color='grey', alpha=0.2)
374+
375+ ax.text(1841, ylim + ylim*0.15,
376+ 'First Opium War\n(1839–1842)',
377+ color='tab:red', **t_params)
378+ ax.axvspan(1839, 1842, color='tab:red', alpha=0.2)
379+
380+ ax.text(1880, ylim + ylim*0.25,
381+ 'Self-Strengthening Movement\n(1861–1895)',
382+ color='tab:blue', **t_params)
383+ ax.axvspan(1861, 1895, color='tab:blue', alpha=0.2)
384+
385+ ax.text(1942, ylim + ylim*0.05,
386+ 'WW 2\n(1939-1945)',
387+ color='tab:red', **t_params)
388+ ax.axvspan(1939, 1945, color='tab:red', alpha=0.2)
389+
390+ ax.text(1949, ylim + ylim*0.15,
391+ 'Founding of PRC\n(1949)',
392+ color=color_mapping['CHN'], **t_params)
393+ ax.axvspan(1948, 1950, color=color_mapping['CHN'], alpha=0.2)
394+
395+ ax.text(1960, ylim + ylim*0.25,
396+ 'Great Leap Forward\n(1958-1962)',
397+ color='tab:orange', **t_params)
398+ ax.axvspan(1958, 1962, color='tab:orange', alpha=0.2)
399+
400+ ax.text(1978, ylim + ylim*0.35,
401+ 'Reform and Opening-up\n(1978-1979)',
402+ color='tab:blue', **t_params)
403+ ax.axvspan(1978, 1979, color='tab:blue', alpha=0.2)
404+
405+ plt.show()
406+ ```
407+
408+ ``` {code-cell} ipython3
409+ fig, ax = plt.subplots(dpi=300)
410+
411+ cntry = ['GBR', 'USA']
412+ ax = draw_interp_plots(gdppc[cntry].loc[1500:2000],
413+ 'International $\'s','Year',
414+ color_mapping, code_to_name, 2, True, ax)
415+
416+ ylim = ax.get_ylim()[1]
417+
418+ ax.text(1651, ylim + ylim*0.1,
419+ 'Navigation Act (UK)\n(1651)',
420+ color='tab:orange', **t_params)
421+ ax.axvspan(1651, 1651, color='tab:orange', alpha=0.2)
422+
423+ ax.text(1849, ylim + ylim*0.50,
424+ 'Repeal of Navigation Act (UK)\n(1849)',
425+ color='tab:blue', **t_params)
426+ ax.axvspan(1848, 1850, color='tab:blue', alpha=0.2)
427+
428+ ax.text(1800, ylim + ylim*0.1,
429+ 'Industrial Revolution\n(1740-1860)',
430+ color='grey', **t_params)
431+ ax.axvspan(1760, 1840, color='grey', alpha=0.2)
432+
433+ ax.text(1789, ylim + ylim*0.35,
434+ 'Federation (US)\n(1789)',
435+ color=color_mapping['USA'], **t_params)
436+ ax.axvspan(1788, 1790, color=color_mapping['USA'], alpha=0.2)
437+
438+ ax.text(1863, ylim + ylim*0.8,
439+ 'American Civil War (US)\n(1861-1865)',
440+ color=color_mapping['USA'], **t_params)
441+ ax.axvspan(1861, 1865, color=color_mapping['USA'], alpha=0.2)
442+
443+ ax.text(1916, ylim + ylim*0.1,
444+ 'WW 1\n(1939-1945)',
445+ color='tab:red', **t_params)
446+ ax.axvspan(1914, 1918, color='tab:red', alpha=0.2)
447+
448+
449+ ax.text(1933, ylim + ylim*0.35,
450+ 'the Great Depression\n(1929–1939)',
451+ color='grey', **t_params)
452+ ax.axvspan(1929, 1938.5, color='grey', alpha=0.2)
453+
454+ ax.text(1942, ylim + ylim*0.65,
455+ 'WW 2\n(1939-1945)',
456+ color='tab:red', **t_params)
457+ ax.axvspan(1939, 1945, color='tab:red', alpha=0.2)
458+
459+
460+
347461plt.show()
348462```
349463
350464+++ {"user_expressions": [ ] }
351465
352- As you can see the countries had similar GDP per capita levels with divergence starting around 1940. Australia's growth experience is both more continuous and less volatile post 1940.
466+ We can see some interesting trends:
353467
468+ - Most of the growth happened in the past 150 years after the industrial revolution.
469+ - There is a divergence in the west and east during the process of industralization (from 1820 to 1940).
470+ - The gap is repeatly closing in the modern era.
471+ - The shift in the paradigm in policy is usually intertwined with the technological and political.
472+
473+ We will look into these trends in more details
354474
355475## The Industrialized World
356476
@@ -377,25 +497,13 @@ mystnb:
377497 caption: GDP
378498 name: gdp1
379499---
380- fig = plt.figure (dpi=110 )
500+ fig, ax = plt.subplots (dpi=300 )
381501ax = fig.gca()
382- cntry = ['DEU', 'SUN', 'USA', 'GBR', 'FRA', 'JPN', 'CHN']
383- start_year, end_year = (1820,1940)
384- line_color = ['blue', 'orange', 'green', 'red', 'yellow', 'purple', 'slategrey']
385- gdp[cntry].loc[start_year:end_year].interpolate().plot(
386- ax = ax,
387- ylabel = 'International $\'s',
388- xlabel = 'Year',
389- color = line_color
390- )
391-
392- # Build Custom Legend
393- legend_elements = []
394- for i,c in enumerate(cntry):
395- line = Line2D([0], [0], color=line_color[i], lw=2, label=code_to_name.loc[c]['country'])
396- legend_elements.append(line)
397- ax.legend(handles=legend_elements, loc='lower center', ncol=4, bbox_to_anchor=[0.5, -0.26])
398- plt.show()
502+ cntry = ['CHN', 'SUN', 'JPN', 'GBR', 'USA']
503+ start_year, end_year = (1820, 1940)
504+ ax = draw_interp_plots(gdp[cntry].loc[start_year:end_year],
505+ 'International $\'s','Year',
506+ color_mapping, code_to_name, 2, False, ax)
399507```
400508
401509+++ {"user_expressions": [ ] }
@@ -409,25 +517,13 @@ mystnb:
409517 caption: GDP per Capita
410518 name: gdppc1
411519---
412- fig = plt.figure (dpi=110 )
520+ fig, ax = plt.subplots (dpi=300 )
413521ax = fig.gca()
414- cntry = ['DEU', 'SUN', 'USA', 'GBR', 'FRA', 'JPN', 'CHN']
415- start_year, end_year = (1820,1940)
416- line_color = ['blue', 'orange', 'green', 'red', 'yellow', 'purple', 'slategrey']
417- gdppc[cntry].loc[start_year:end_year].interpolate().plot(
418- ax = ax,
419- ylabel = 'International $\'s',
420- xlabel = 'Year',
421- color = line_color
422- )
423-
424- # Build Custom Legend
425- legend_elements = []
426- for i,c in enumerate(cntry):
427- line = Line2D([0], [0], color=line_color[i], lw=2, label=code_to_name.loc[c]['country'])
428- legend_elements.append(line)
429- ax.legend(handles=legend_elements, loc='lower center', ncol=4, bbox_to_anchor=[0.5, -0.25])
430- plt.show()
522+ cntry = ['CHN', 'SUN', 'JPN', 'GBR', 'USA']
523+ start_year, end_year = (1820, 1940)
524+ ax = draw_interp_plots(gdppc[cntry].loc[start_year:end_year],
525+ 'International $\'s','Year',
526+ color_mapping, code_to_name, 2, False, ax)
431527```
432528
433529+++ {"user_expressions": [ ] }
@@ -443,25 +539,13 @@ mystnb:
443539 caption: GDP
444540 name: gdp2
445541---
446- fig = plt.figure (dpi=300)
542+ fig, ax = plt.subplots (dpi=300)
447543ax = fig.gca()
448- cntry = ['DEU', 'SUN', 'USA', 'GBR', 'FRA', 'JPN', 'CHN']
449- start_year, end_year = (1970, 2018)
450- line_color = ['blue', 'orange', 'green', 'red', 'yellow', 'purple', 'slategrey']
451- gdp[cntry].loc[start_year:end_year].interpolate().plot(
452- ax = ax,
453- ylabel = 'International $\'s',
454- xlabel = 'Year',
455- color = line_color
456- )
457-
458- # Build Custom Legend
459- legend_elements = []
460- for i,c in enumerate(cntry):
461- line = Line2D([0], [0], color=line_color[i], lw=2, label=code_to_name.loc[c]['country'])
462- legend_elements.append(line)
463- ax.legend(handles=legend_elements, loc='lower center', ncol=4, bbox_to_anchor=[0.5, -0.25])
464- plt.show()
544+ cntry = ['CHN', 'SUN', 'JPN', 'USA']
545+ start_year, end_year = (1970, 2020)
546+ ax = draw_interp_plots(gdp[cntry].loc[start_year:end_year],
547+ 'International $\'s','Year',
548+ color_mapping, code_to_name, 2, False, ax)
465549```
466550
467551+++ {"user_expressions": [ ] }
@@ -475,25 +559,13 @@ mystnb:
475559 caption: GDP per Capita
476560 name: gdppc2
477561---
478- fig = plt.figure (dpi=300)
562+ fig, ax = plt.subplots (dpi=300)
479563ax = fig.gca()
480- cntry = ['DEU', 'SUN', 'USA', 'GBR', 'FRA', 'JPN', 'CHN']
481- start_year, end_year = (1970, 2018)
482- line_color = ['blue', 'orange', 'green', 'red', 'yellow', 'purple', 'slategrey']
483- gdppc[cntry].loc[start_year:end_year].interpolate().plot(
484- ax = ax,
485- ylabel = 'International $\'s',
486- xlabel = 'Year',
487- color = line_color
488- )
489-
490- # Build Custom Legend
491- legend_elements = []
492- for i,c in enumerate(cntry):
493- line = Line2D([0], [0], color=line_color[i], lw=2, label=code_to_name.loc[c]['country'])
494- legend_elements.append(line)
495- ax.legend(handles=legend_elements, loc='lower center', ncol=3, bbox_to_anchor=[0.5, -0.3])
496- plt.show()
564+ cntry = ['CHN', 'SUN', 'JPN', 'USA']
565+ start_year, end_year = (1970, 2020)
566+ ax = draw_interp_plots(gdppc[cntry].loc[start_year:end_year],
567+ 'International $\'s','Year',
568+ color_mapping, code_to_name, 2, False, ax)
497569```
498570
499571+++ {"user_expressions": [ ] }
@@ -502,14 +574,6 @@ plt.show()
502574
503575Here are a collection of interesting plots that could be linked to interesting stories
504576
505- Looking at China GDP per capita levels from 1500 through to the 1970's showed a long period of declining GDP per capital levels from 1700's to early 20th century. (Closed Border / Inward Looking Domestic Focused Policies?)
506-
507- ``` {code-cell} ipython3
508- fig = plt.figure(dpi=300)
509- gdppc['CHN'].loc[1500:1980].interpolate().plot(ax=fig.gca())
510- plt.show()
511- ```
512-
513577+++ {"user_expressions": [ ] }
514578
515579China (CHN) then followed a very similar growth story from the 1980s through to current day China.
0 commit comments