@@ -28,8 +28,6 @@ We can then import the Python modules we will use.
28
28
import numpy as np
29
29
import pandas as pd
30
30
import matplotlib.pyplot as plt
31
- plt.matplotlib.rcParams['figure.figsize'] = (12,8)
32
- plt.rcParams.update({'font.size': 19})
33
31
import matplotlib.dates as mdates
34
32
```
35
33
@@ -102,10 +100,9 @@ for col in cols:
102
100
103
101
ax.legend()
104
102
ax.set_ylabel('Index 1913 = 100')
103
+ ax.set_xlabel('Year')
105
104
ax.set_xlim(xmin=1600)
106
105
plt.tight_layout()
107
- fig.text(.5, .0001,
108
- "Price levels", ha='center')
109
106
plt.show()
110
107
```
111
108
@@ -171,11 +168,10 @@ for col in cols:
171
168
172
169
ax.set_yscale('log')
173
170
ax.set_ylabel('Index 1913 = 100')
174
- ax.set_xlim(xmin=1600)
175
171
ax.set_ylim([10, 1e6])
172
+ ax.set_xlabel('Logs of price levels')
173
+ ax.set_xlim(xmin=1600)
176
174
plt.tight_layout()
177
- fig.text(.5, .0001,
178
- "Logs of price levels", ha='center')
179
175
plt.show()
180
176
```
181
177
@@ -305,9 +301,9 @@ def pe_plot(p_seq, e_seq, index, labs, ax):
305
301
label.set_rotation(45)
306
302
307
303
# set labels
308
- ax.text(-0.08, 1.03, 'Price level', transform=ax.transAxes )
309
- ax.text(0.92, 1.03, 'Exchange rate', transform=ax.transAxes )
310
-
304
+ ax.set_ylabel( 'Price level')
305
+ ax1.set_ylabel( 'Exchange rate')
306
+
311
307
ax1.legend(loc='upper left')
312
308
313
309
return ax1
@@ -326,9 +322,7 @@ def pr_plot(p_seq, index, ax):
326
322
# calculate and plot moving average
327
323
diff_smooth = pd.DataFrame(log_diff_p).rolling(3, center=True).mean()
328
324
ax.plot(index[1:], diff_smooth, label='Moving average (3 period)', alpha=0.5, lw=2)
329
- ax.text(-0.08, 1.03,
330
- 'Monthly inflation rate',
331
- transform=ax.transAxes)
325
+ ax.set_ylabel('Inflation rate')
332
326
333
327
ax.xaxis.set_major_locator(
334
328
mdates.MonthLocator(interval=5))
0 commit comments