Skip to content

Commit 07433c8

Browse files
authored
FIX: matplotlib strings with LaTeX (#434)
1 parent 463d1e2 commit 07433c8

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

lectures/re_with_feedback.md

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ tags: [hide-output]
3838

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

448447
```{code-cell} python3
449448
plt.figure()
450-
plt.plot(range(T+1), m_seq, label='$m_t$')
451-
plt.plot(range(T+1), p_seq, label='$p_t$')
449+
plt.plot(range(T+1), m_seq, label=r'$m_t$')
450+
plt.plot(range(T+1), p_seq, label=r'$p_t$')
452451
plt.xlabel('t')
453-
plt.title(f'λ={λ}, α={α}, $ρ_1$={ρ1}, $ρ_2$={ρ2}')
452+
plt.title(rf'λ={λ}, α={α}, $ρ_1$={ρ1}, $ρ_2$={ρ2}')
454453
plt.legend()
455454
plt.show()
456455
```
@@ -938,8 +937,8 @@ for δ in [-0.05, 0, 0.05]:
938937
plt.plot(m_range, [magic_p0(m0, δ=δ) for m0 in m_range], label=f"δ={δ}")
939938
plt.legend()
940939
941-
plt.xlabel("$m_0$")
942-
plt.ylabel("$p_0$")
940+
plt.xlabel(r"$m_0$")
941+
plt.ylabel(r"$p_0$")
943942
plt.show()
944943
```
945944

@@ -951,9 +950,9 @@ m0 = 1
951950
952951
δ_range = np.linspace(-0.05, 0.05, 100)
953952
plt.plot(δ_range, [magic_p0(m0, δ=δ) for δ in δ_range])
954-
plt.xlabel('$\delta$')
955-
plt.ylabel('$p_0$')
956-
plt.title(f'$m_0$={m0}')
953+
plt.xlabel(r'$\delta$')
954+
plt.ylabel(r'$p_0$')
955+
plt.title(rf'$m_0$={m0}')
957956
plt.show()
958957
```
959958

0 commit comments

Comments
 (0)