Skip to content

Commit 8d85a71

Browse files
authored
Merge pull request #21871 from ojeda-e/issue21863
DOC: Code from markevery_prop_cycle moved to test.
2 parents 2b5990f + c6fb692 commit 8d85a71

File tree

3 files changed

+26
-65
lines changed

3 files changed

+26
-65
lines changed

doc/users/prev_whats_new/whats_new_3.0.rst

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,7 @@ Support for axes.prop_cycle property *markevery* in rcParams
109109

110110
The Matplotlib ``rcParams`` settings object now supports configuration
111111
of the attribute :rc:`axes.prop_cycle` with cyclers using the *markevery*
112-
Line2D object property. An example of this feature is provided at
113-
:doc:`/gallery/lines_bars_and_markers/markevery_prop_cycle`.
112+
Line2D object property.
114113

115114
Multi-page PDF support for pgf backend
116115
--------------------------------------

examples/lines_bars_and_markers/markevery_prop_cycle.py

Lines changed: 0 additions & 63 deletions
This file was deleted.

lib/matplotlib/tests/test_lines.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -343,3 +343,28 @@ def test_input_copy(fig_test, fig_ref):
343343
# Trigger cache invalidation
344344
l.set_drawstyle("steps")
345345
fig_ref.add_subplot().plot([0, 2, 4], [0, 2, 4], ".-", drawstyle="steps")
346+
347+
348+
@check_figures_equal(extensions=["png"])
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)]
354+
355+
cmap = plt.get_cmap('jet')
356+
colors = cmap(np.linspace(0.2, 0.8, len(cases)))
357+
358+
x = np.linspace(-1, 1)
359+
y = 5 * x**2
360+
361+
axs = fig_ref.add_subplot()
362+
for i, markevery in enumerate(cases):
363+
axs.plot(y - i, 'o-', markevery=markevery, color=colors[i])
364+
365+
matplotlib.rcParams['axes.prop_cycle'] = cycler(markevery=cases,
366+
color=colors)
367+
368+
ax = fig_test.add_subplot()
369+
for i, _ in enumerate(cases):
370+
ax.plot(y - i, 'o-')

0 commit comments

Comments
 (0)