@@ -184,12 +184,7 @@ t_params = {'color':'grey', 'fontsize': 9,
184184Let's start with the United States.
185185
186186``` {code-cell}  ipython3
187- --- 
188- mystnb: 
189-   figure: 
190-     caption: United States (GDP growth rate %) 
191-     name: us_gdp 
192- --- 
187+ :label: bc-plot-fig-1 
193188fig, ax = plt.subplots() 
194189
195190country = 'United States' 
@@ -200,7 +195,11 @@ plot_series(gdp_growth, country,
200195plt.show() 
201196``` 
202197
203- +++ {"user_expressions": [ ] }
198+ :::{figure} #bc-plot-fig-1
199+ :label :  us_gdp
200+ United States (GDP growth rate %)
201+ :::
202+ 
204203
205204GDP growth is positive on average and trending slightly downward over time.
206205
@@ -216,12 +215,7 @@ in the growth rate and significant fluctuations.
216215Notice the very large dip during the Covid-19 pandemic.
217216
218217``` {code-cell}  ipython3
219- --- 
220- mystnb: 
221-   figure: 
222-     caption: United Kingdom (GDP growth rate %) 
223-     name: uk_gdp 
224- --- 
218+ :label: bc-plot-fig-2 
225219fig, ax = plt.subplots() 
226220
227221country = 'United Kingdom' 
@@ -231,7 +225,10 @@ plot_series(gdp_growth, country,
231225plt.show() 
232226``` 
233227
234- +++ {"user_expressions": [ ] }
228+ :::{figure} #bc-plot-fig-2
229+ :label :  uk_gdp
230+ United Kingdom (GDP growth rate %)
231+ :::
235232
236233Now let's consider Japan, which experienced rapid growth in the 1960s and
2372341970s, followed by slowed expansion in the past two decades.
@@ -240,12 +237,7 @@ Major dips in the growth rate coincided with the Oil Crisis of the 1970s, the
240237Global Financial Crisis (GFC) and the Covid-19 pandemic.
241238
242239``` {code-cell}  ipython3
243- --- 
244- mystnb: 
245-   figure: 
246-     caption: Japan (GDP growth rate %) 
247-     name: jp_gdp 
248- --- 
240+ :label: bc-plot-fig-3 
249241fig, ax = plt.subplots() 
250242
251243country = 'Japan' 
@@ -255,15 +247,15 @@ plot_series(gdp_growth, country,
255247plt.show() 
256248``` 
257249
250+ :::{figure} #bc-plot-fig-3
251+ :label :  jp_gdp
252+ Japan (GDP growth rate %)
253+ :::
254+ 
258255Now let's study Greece.
259256
260257``` {code-cell}  ipython3
261- --- 
262- mystnb: 
263-   figure: 
264-     caption: Greece (GDP growth rate %) 
265-     name: gc_gdp 
266- --- 
258+ :label: bc-plot-fig-4 
267259fig, ax = plt.subplots() 
268260
269261country = 'Greece' 
@@ -273,18 +265,18 @@ plot_series(gdp_growth, country,
273265plt.show() 
274266``` 
275267
268+ :::{figure} #bc-plot-fig-4
269+ :label :  gc_gdp
270+ Greece (GDP growth rate %)
271+ :::
272+ 
276273Greece experienced a very large drop in GDP growth around 2010-2011, during the peak
277274of the Greek debt crisis.
278275
279276Next let's consider Argentina.
280277
281278``` {code-cell}  ipython3
282- --- 
283- mystnb: 
284-   figure: 
285-     caption: Argentina (GDP growth rate %) 
286-     name: arg_gdp 
287- --- 
279+ :label: bc-plot-fig-5 
288280fig, ax = plt.subplots() 
289281
290282country = 'Argentina' 
@@ -294,6 +286,11 @@ plot_series(gdp_growth, country,
294286plt.show() 
295287``` 
296288
289+ :::{figure} #bc-plot-fig-5
290+ :label :  arg_gdp
291+ Argentina (GDP growth rate %)
292+ :::
293+ 
297294Notice that Argentina has experienced far more volatile cycles than
298295the economies examined above.
299296
@@ -329,13 +326,8 @@ Let's plot the unemployment rate in the US from 1929 to 2022 with recessions
329326defined by the NBER.
330327
331328``` {code-cell}  ipython3
332- --- 
333- mystnb: 
334-   figure: 
335-     caption: Long-run unemployment rate, US (%) 
336-     name: lrunrate 
337- tags: [hide-input] 
338- --- 
329+ :label: bc-plot-fig-6 
330+ :tags: [hide-input] 
339331# We use the census bureau's estimate for the unemployment rate  
340332# between 1942 and 1948 
341333years = [datetime.datetime(year, 6, 1) for year in range(1942, 1948)] 
@@ -378,6 +370,11 @@ ax.set_ylabel('unemployment rate (%)')
378370plt.show() 
379371``` 
380372
373+ :::{figure} #bc-plot-fig-6
374+ :label :  lrunrate
375+ Long-run unemployment rate, US (%)
376+ :::
377+ 
381378The plot shows that 
382379
383380*  expansions and contractions of the labor market have been highly correlated
@@ -495,13 +492,8 @@ gdp_growth.columns = gdp_growth.columns.str.replace('YR', '').astype(int)
495492We use the United Kingdom, United States, Germany, and Japan as examples of developed economies.
496493
497494``` {code-cell}  ipython3
498- --- 
499- mystnb: 
500-   figure: 
501-     caption: Developed economies (GDP growth rate %) 
502-     name: adv_gdp 
503- tags: [hide-input] 
504- --- 
495+ :label: bc-plot-fig-7 
496+ :tags: [hide-input] 
505497fig, ax = plt.subplots() 
506498countries = ['United Kingdom', 'United States', 'Germany', 'Japan'] 
507499ylabel = 'GDP growth rate (%)' 
@@ -512,16 +504,16 @@ plot_comparison(gdp_growth.loc[countries, 1962:],
512504plt.show() 
513505``` 
514506
507+ :::{figure} #bc-plot-fig-7
508+ :label :  adv_gdp
509+ Developed economies (GDP growth rate %)
510+ :::
511+ 
515512We choose Brazil, China, Argentina, and Mexico as representative developing economies.
516513
517514``` {code-cell}  ipython3
518- --- 
519- mystnb: 
520-   figure: 
521-     caption: Developing economies (GDP growth rate %) 
522-     name: deve_gdp 
523- tags: [hide-input] 
524- --- 
515+ :label: bc-plot-fig-8 
516+ :tags: [hide-input] 
525517fig, ax = plt.subplots() 
526518countries = ['Brazil', 'China', 'Argentina', 'Mexico'] 
527519plot_comparison(gdp_growth.loc[countries, 1962:],  
@@ -531,6 +523,11 @@ plot_comparison(gdp_growth.loc[countries, 1962:],
531523plt.show() 
532524``` 
533525
526+ :::{figure} #bc-plot-fig-8
527+ :label :  deve_gdp
528+ Developing economies (GDP growth rate %)
529+ :::
530+ 
534531The comparison of GDP growth rates above suggests that 
535532business cycles are becoming more synchronized in 21st-century recessions.
536533
@@ -547,13 +544,8 @@ Here we compare the unemployment rate of the United States,
547544the United Kingdom, Japan, and France.
548545
549546``` {code-cell}  ipython3
550- --- 
551- mystnb: 
552-   figure: 
553-     caption: Developed economies (unemployment rate %) 
554-     name: adv_unemp 
555- tags: [hide-input] 
556- --- 
547+ :label: bc-plot-fig-9 
548+ :tags: [hide-input] 
557549unempl_rate = wb.data.DataFrame('SL.UEM.TOTL.NE.ZS', 
558550    ['USA', 'FRA', 'GBR', 'JPN'], labels=True) 
559551unempl_rate = unempl_rate.set_index('Country') 
@@ -569,6 +561,11 @@ plot_comparison(unempl_rate, countries,
569561plt.show() 
570562``` 
571563
564+ :::{figure} #bc-plot-fig-9
565+ :label :  adv_unemp
566+ Developed economies (unemployment rate %)
567+ :::
568+ 
572569We see that France, with its strong labor unions, typically experiences
573570relatively slow labor market recoveries after negative shocks.
574571
@@ -598,13 +595,8 @@ year-on-year
598595(CPI) change from 1978-2022 in the US.
599596
600597``` {code-cell}  ipython3
601- --- 
602- mystnb: 
603-   figure: 
604-     caption: Consumer sentiment index and YoY CPI change, US 
605-     name: csicpi 
606- tags: [hide-input] 
607- --- 
598+ :label: bc-plot-fig-10 
599+ :tags: [hide-input] 
608600start_date = datetime.datetime(1978, 1, 1) 
609601end_date = datetime.datetime(2022, 12, 31) 
610602
@@ -656,6 +648,11 @@ ax_t.set_ylabel('CPI YoY change (%)')
656648plt.show() 
657649``` 
658650
651+ :::{figure} #bc-plot-fig-10
652+ :label :  csicpi
653+ Consumer sentiment index and YoY CPI change, US
654+ :::
655+ 
659656We see that 
660657
661658*  consumer sentiment often remains high during expansions and
@@ -679,13 +676,8 @@ We plot the real industrial output change from the previous year
679676from 1919 to 2022 in the US to show this trend.
680677
681678``` {code-cell}  ipython3
682- --- 
683- mystnb: 
684-   figure: 
685-     caption: YoY real output change, US (%) 
686-     name: roc 
687- tags: [hide-input] 
688- --- 
679+ :label: bc-plot-fig-11 
680+ :tags: [hide-input] 
689681start_date = datetime.datetime(1919, 1, 1) 
690682end_date = datetime.datetime(2022, 12, 31) 
691683
@@ -709,6 +701,11 @@ ax.set_ylabel('YoY real output change (%)')
709701plt.show() 
710702``` 
711703
704+ :::{figure} #bc-plot-fig-11
705+ :label :  roc
706+ YoY real output change, US (%)
707+ :::
708+ 
712709We observe the delayed contraction in the plot across recessions.
713710
714711
@@ -726,13 +723,8 @@ The following graph shows the domestic credit to the private sector as a
726723percentage of GDP by banks from 1970 to 2022 in the UK.
727724
728725``` {code-cell}  ipython3
729- --- 
730- mystnb: 
731-   figure: 
732-     caption: Domestic credit to private sector by banks (% of GDP) 
733-     name: dcpc 
734- tags: [hide-input] 
735- --- 
726+ :label: bc-plot-fig-12 
727+ :tags: [hide-input] 
736728private_credit = wb.data.DataFrame('FS.AST.PRVT.GD.ZS',  
737729                ['GBR'], labels=True) 
738730private_credit = private_credit.set_index('Country') 
@@ -748,5 +740,10 @@ ax = plot_series(private_credit, countries,
748740plt.show() 
749741``` 
750742
743+ :::{figure} #bc-plot-fig-12
744+ :label :  dcpc
745+ Domestic credit to private sector by banks (% of GDP)
746+ :::
747+ 
751748Note that the credit rises during economic expansions
752- and stagnates or even contracts after recessions.
749+ and stagnates or even contracts after recessions.
0 commit comments