Skip to content

Commit 7a64735

Browse files
committed
fix synax warnings in matplotlib.md
1 parent d1c899a commit 7a64735

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

lectures/matplotlib.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ If everything is properly configured, then adding LaTeX is trivial
122122

123123
```{code-cell} python3
124124
fig, ax = plt.subplots()
125-
ax.plot(x, y, 'r-', linewidth=2, label='$y=\sin(x)$', alpha=0.6)
125+
ax.plot(x, y, 'r-', linewidth=2, label=r'$y=\sin(x)$', alpha=0.6)
126126
ax.legend(loc='upper center')
127127
plt.show()
128128
```
@@ -131,7 +131,7 @@ Controlling the ticks, adding titles and so on is also straightforward
131131

132132
```{code-cell} python3
133133
fig, ax = plt.subplots()
134-
ax.plot(x, y, 'r-', linewidth=2, label='$y=\sin(x)$', alpha=0.6)
134+
ax.plot(x, y, 'r-', linewidth=2, label=r'$y=\sin(x)$', alpha=0.6)
135135
ax.legend(loc='upper center')
136136
ax.set_yticks([-1, 0, 1])
137137
ax.set_title('Test plot')
@@ -163,7 +163,7 @@ x = np.linspace(-4, 4, 150)
163163
for i in range(3):
164164
m, s = uniform(-1, 1), uniform(1, 2)
165165
y = norm.pdf(x, loc=m, scale=s)
166-
current_label = f'$\mu = {m:.2}$'
166+
current_label = rf'$\mu = {m:.2}$'
167167
ax.plot(x, y, linewidth=2, alpha=0.6, label=current_label)
168168
ax.legend()
169169
plt.show()
@@ -186,7 +186,7 @@ for i in range(num_rows):
186186
m, s = uniform(-1, 1), uniform(1, 2)
187187
x = norm.rvs(loc=m, scale=s, size=100)
188188
axes[i, j].hist(x, alpha=0.6, bins=20)
189-
t = f'$\mu = {m:.2}, \quad \sigma = {s:.2}$'
189+
t = rf'$\mu = {m:.2}, \quad \sigma = {s:.2}$'
190190
axes[i, j].set(title=t, xticks=[-4, 0, 4], yticks=[])
191191
plt.show()
192192
```
@@ -419,7 +419,7 @@ x = np.linspace(-4, 4, 150)
419419
for i in range(3):
420420
m, s = uniform(-1, 1), uniform(1, 2)
421421
y = norm.pdf(x, loc=m, scale=s)
422-
current_label = f'$\mu = {m:.2}$'
422+
current_label = rf'$\mu = {m:.2}$'
423423
ax.plot(x, y, linewidth=2, alpha=0.6, label=current_label)
424424
ax.legend()
425425
plt.show()

0 commit comments

Comments
 (0)