Skip to content

Commit

Permalink
FIX: matplotlib strings with LaTeX (#434)
Browse files Browse the repository at this point in the history
  • Loading branch information
mmcky authored Dec 5, 2024
1 parent 463d1e2 commit 07433c8
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions lectures/re_with_feedback.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ tags: [hide-output]

```{code-cell} ipython
import matplotlib.pyplot as plt
plt.rcParams["figure.figsize"] = (11, 5) #set default figure size
import numpy as np
import quantecon as qe
from sympy import init_printing, symbols, Matrix
Expand Down Expand Up @@ -447,10 +446,10 @@ for t in range(T):

```{code-cell} python3
plt.figure()
plt.plot(range(T+1), m_seq, label='$m_t$')
plt.plot(range(T+1), p_seq, label='$p_t$')
plt.plot(range(T+1), m_seq, label=r'$m_t$')
plt.plot(range(T+1), p_seq, label=r'$p_t$')
plt.xlabel('t')
plt.title(f'λ={λ}, α={α}, $ρ_1$={ρ1}, $ρ_2$={ρ2}')
plt.title(rf'λ={λ}, α={α}, $ρ_1$={ρ1}, $ρ_2$={ρ2}')
plt.legend()
plt.show()
```
Expand Down Expand Up @@ -938,8 +937,8 @@ for δ in [-0.05, 0, 0.05]:
plt.plot(m_range, [magic_p0(m0, δ=δ) for m0 in m_range], label=f"δ={δ}")
plt.legend()
plt.xlabel("$m_0$")
plt.ylabel("$p_0$")
plt.xlabel(r"$m_0$")
plt.ylabel(r"$p_0$")
plt.show()
```

Expand All @@ -951,9 +950,9 @@ m0 = 1
δ_range = np.linspace(-0.05, 0.05, 100)
plt.plot(δ_range, [magic_p0(m0, δ=δ) for δ in δ_range])
plt.xlabel('$\delta$')
plt.ylabel('$p_0$')
plt.title(f'$m_0$={m0}')
plt.xlabel(r'$\delta$')
plt.ylabel(r'$p_0$')
plt.title(rf'$m_0$={m0}')
plt.show()
```

Expand Down

0 comments on commit 07433c8

Please sign in to comment.