@@ -71,21 +71,6 @@ import numpy as np
7171from quantecon import Kalman, LinearStateSpace
7272from collections import namedtuple
7373from scipy.stats import multivariate_normal
74- import matplotlib as mpl
75-
76- # Configure Matplotlib to use pdfLaTeX and CJKutf8
77- mpl.rcParams.update({
78- 'text.usetex': True,
79- 'text.latex.preamble': r'''
80- \usepackage{{CJKutf8}}
81- \usepackage{{amsmath}}
82- \usepackage{{amsfonts}}
83- '''
84- })
85-
86- # Function to wrap Chinese text in CJK environment
87- def cjk(text):
88- return rf'\begin{{CJK}}{{UTF8}}{{gbsn}}{text}\end{{CJK}}'
8974```
9075
9176## 劳动者的产出
@@ -299,17 +284,17 @@ mystnb:
299284fig, ax = plt.subplots(1, 2)
300285
301286ax[0].plot(y_hat_t, label=r'$\mathbb{E}[y_t| y^{t-1}]$')
302- ax[0].set_xlabel(cjk( '时间') )
287+ ax[0].set_xlabel('时间')
303288ax[0].set_ylabel(r'$\mathbb{E}[y_t| y^{t-1}]$')
304- ax[0].set_title(cjk( '$\mathbb{E}[y_t| y^{t-1}]$ 随时间变化') )
289+ ax[0].set_title(r '$\mathbb{E}[y_t| y^{t-1}]$ 随时间变化')
305290ax[0].legend()
306291
307292ax[1].plot(u_hat_t, label=r'$\mathbb{E}[u_0|y^{t-1}]$')
308293ax[1].axhline(y=u_0, color='grey',
309294 linestyle='dashed', label=fr'$u_0={u_0:.2f}$')
310- ax[1].set_xlabel(cjk( '时间') )
295+ ax[1].set_xlabel('时间')
311296ax[1].set_ylabel(r'$\mathbb{E}[u_0|y^{t-1}]$')
312- ax[1].set_title(cjk( '推断的工作伦理随时间变化') )
297+ ax[1].set_title('推断的工作伦理随时间变化')
313298ax[1].legend()
314299
315300fig.tight_layout()
@@ -362,7 +347,7 @@ for i, t in enumerate(np.linspace(0, T-1, 3, dtype=int)):
362347 # 创建 PDF 的等高线图
363348 con = axs[i].contour(h, u, pdf_values, cmap='viridis')
364349 axs[i].clabel(con, inline=1, fontsize=10)
365- axs[i].set_title(cjk( '时间步') +f' {t}')
350+ axs[i].set_title('时间步'+f' {t}')
366351 axs[i].set_xlabel(r'$h_{{{}}}$'.format(str(t)))
367352 axs[i].set_ylabel(r'$u_{{{}}}$'.format(str(t)))
368353
@@ -463,17 +448,17 @@ for t in range(T):
463448fig, ax = plt.subplots(1, 2)
464449
465450ax[0].plot(y_hat_t, label=r'$\mathbb{E}[y_t| y^{t-1}]$')
466- ax[0].set_xlabel(cjk( '时间') )
451+ ax[0].set_xlabel('时间')
467452ax[0].set_ylabel(r'$\mathbb{E}[y_t| y^{t-1}]$')
468- ax[0].set_title(cjk( '$\mathbb{E}[y_t| y^{t-1}]$ 随时间变化') )
453+ ax[0].set_title(r '$\mathbb{E}[y_t| y^{t-1}]$ 随时间变化')
469454ax[0].legend()
470455
471456ax[1].plot(u_hat_t, label=r'$\mathbb{E}[u_0|y^{t-1}]$')
472457ax[1].axhline(y=u_0, color='grey',
473458 linestyle='dashed', label=fr'$u_0={u_0:.2f}$')
474- ax[1].set_xlabel(cjk( '时间') )
459+ ax[1].set_xlabel('时间')
475460ax[1].set_ylabel(r'$\mathbb{E}[u_0|y^{t-1}]$')
476- ax[1].set_title(cjk( '推断的工作伦理随时间变化') )
461+ ax[1].set_title('推断的工作伦理随时间变化')
477462ax[1].legend()
478463
479464fig.tight_layout()
@@ -543,7 +528,7 @@ def simulate_workers(worker, T, ax, μ_sim_0=None, Σ_sim_0=None,
543528 if diff :
544529 ax.plot(u_hat_t - u_0, alpha=.5, label=name)
545530 ax.axhline(y=0, color='grey', linestyle='dashed')
546- ax.set_xlabel(cjk( '时间') )
531+ ax.set_xlabel('时间')
547532 ax.set_ylabel(r'$\mathbb{E}[u_0|y^{t-1}] - u_0$')
548533
549534 else:
@@ -553,7 +538,7 @@ def simulate_workers(worker, T, ax, μ_sim_0=None, Σ_sim_0=None,
553538 u_hat_plot = ax.plot(u_hat_t, label=label_line)
554539 ax.axhline(y=u_0, color=u_hat_plot[0].get_color(),
555540 linestyle='dashed', alpha=0.5)
556- ax.set_xlabel(cjk( '时间') )
541+ ax.set_xlabel('时间')
557542 ax.set_ylabel(r'$\mathbb{E}[u_0|y^{t-1}]$')
558543```
559544
@@ -668,9 +653,9 @@ fig, ax = plt.subplots(figsize=(7, 7))
668653
669654worker = create_worker(uhat_0=1, α=0.5, β=0.3)
670655simulate_workers(worker, T, ax, μ_sim_0=μ_sim_0_1, Σ_sim_0=Σ_sim_0,
671- diff=False, name=cjk( '勤奋的劳动者') )
656+ diff=False, name='勤奋的劳动者')
672657simulate_workers(worker, T, ax, μ_sim_0=μ_sim_0_2, Σ_sim_0=Σ_sim_0,
673- diff=False, name=cjk( '普通劳动者') )
658+ diff=False, name='普通劳动者')
674659ax.legend(bbox_to_anchor=(1, 0.5))
675660plt.show()
676661```
0 commit comments