8000 Added suggestions · matplotlib/matplotlib@3f8e2ff · GitHub
[go: up one dir, main page]

Skip to content

Commit 3f8e2ff

Browse files
author
ojeda-e
committed
Added suggestions
1 parent b232e2e commit 3f8e2ff

File tree

1 file changed

+14
-19
lines changed

1 file changed

+14
-19
lines changed

lib/matplotlib/tests/test_lines.py

Lines changed: 14 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,6 @@
2020
from matplotlib.testing.decorators import image_comparison, check_figures_equal
2121

2222

23-
@pytest.fixture
24-
def cases():
25-
"""Define a list of markevery cases to plot."""
26-
cases = [None, 8, (30, 8), [16, 24, 30], [0, -1],
27-
slice(100, 200, 3), 0.1, 0.3, 1.5,
28-
(0.0, 0.1), (0.45, 0.1)]
29-
return cases
30-
31-
3223
def test_segment_hits():
3324
"""Test a problematic case."""
3425
cx, cy = 553, 902
@@ -355,22 +346,26 @@ def test_input_copy(fig_test, fig_ref):
355346

356347

357348
@check_figures_equal(extensions=["png"])
358-
def test_markevery_prop_cycle(fig_test, fig_ref, cases):
349+
def test_markevery_prop_cycle(fig_test, fig_ref):
350+
"""Test that we can set markevery prop_cycle."""
351+
cases = [None, 8, (30, 8), [16, 24, 30], [0, -1],
352+
slice(100, 200, 3), 0.1, 0.3, 1.5,
353+
(0.0, 0.1), (0.45, 0.1)]
359354

360355
cmap = plt.get_cmap('jet')
361356
colors = cmap(np.linspace(0.2, 0.8, len(cases)))
362357

363-
x = np.linspace(0, 2 * np.pi)
364-
offsets = np.linspace(0, 2 * np.pi, 11, endpoint=False)
365-
yy = np.transpose([np.sin(x + phi) for phi in offsets])
358+
x = np.linspace(-1, 1)
359+
y = 5 * x**2
366360

367-
axs = fig_ref.add_axes([0.1, 0.1, 0.6, 0.75])
368-
for i in range(len(cases)):
369-
axs.plot(yy[:, i], markevery=cases[i], c=colors[i])
361+
axs = fig_ref.add_subplot()
362+
for i, markevery in enumerate(cases):
363+
axs.plot(y - i, 'o-', markevery=markevery, color=colors[i])
370364

371365
matplotlib.rcParams['axes.prop_cycle'] = cycler(markevery=cases,
372366
color=colors)
373367

374-
ax = fig_test.add_axes([0.1, 0.1, 0.6, 0.75])
375-
for i in range(len(cases)):
376-
ax.plot(yy[:, i])
368+
ax = fig_test.add_subplot()
369+
for i, _ in enumerate(cases):
370+
ax.plot(y - i, 'o-')
371+

0 commit comments

Comments
 (0)
0