Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e45847c

Browse files
committed
Switch to png for test and zip instead of enumerate over axes
1 parent 018f0fa commit e45847c

File tree

4 files changed

+6
-13
lines changed

4 files changed

+6
-13
lines changed

galleries/examples/images_contours_and_fields/plot_streamplot.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,9 @@
110110
seed_pts = np.column_stack((np.full(n_seed, -1.75), np.linspace(-2, 2, n_seed)))
111111

112112
_, axs = plt.subplots(3, 1, figsize=(6, 14))
113-
for i, max_val in enumerate([0.05, 1, 5]):
113+
for ax, max_val in zip(axs, [0.05, 1, 5]):
114114
t_start = time.time()
115-
axs[i].streamplot(
115+
ax.streamplot(
116116
x,
117117
y,
118118
vx,
@@ -131,7 +131,7 @@
131131
f"streamplot time: {time.time() - t_start:.2f} sec"
132132
if max_val == 1:
133133
text += "\n(default)"
134-
axs[i].text(0.0, 0.0, text, ha="center", va="center")
134+
ax.text(0.0, 0.0, text, ha="center", va="center")
135135

136136
# Draw the cylinder
137137
th_circ = np.linspace(0, 2 * np.pi, 100)
Binary file not shown.

lib/matplotlib/tests/test_streamplot.py

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,7 @@ def test_direction():
100100
linewidth=2, density=2)
101101

102102

103-
@image_comparison(['streamplot_integration.pdf'],
104-
remove_text=True, style='mpl20', tol=0.1)
103+
@image_comparison(['streamplot_integration.png'], style='mpl20')
105104
def test_integration_options():
106105
# Linear potential flow over a lifting cylinder
107106
n = 50
@@ -118,8 +117,8 @@ def test_integration_options():
118117
seed_pts = np.column_stack((np.full(n_seed, -1.75), np.linspace(-2, 2, n_seed)))
119118

120119
fig, axs = plt.subplots(3, 1, figsize=(6, 14))
121-
for i, max_val in enumerate([0.05, 1, 5]):
122-
axs[i].streamplot(
120+
for ax, max_val in zip(axs, [0.05, 1, 5]):
121+
ax.streamplot(
123122
x,
124123
y,
125124
vx,
@@ -133,12 +132,6 @@ def test_integration_options():
133132
integration_max_error_scale=max_val,
134133
)
135134

136-
text = f"integration_max_step_scale: {max_val}\n" \
137-
f"integration_max_error_scale: {max_val}"
138-
if max_val == 1:
139-
text += "\n(default)"
140-
axs[i].text(0.0, 0.0, text, ha="center", va="center")
141-
142135
# Draw the cylinder
143136
th_circ = np.linspace(0, 2 * np.pi, 100)
144137
for ax in axs:

0 commit comments

Comments
 (0)