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

Skip to content

Commit 8f1339f

Browse files
committed
TST: add shotgun test of marker fill styles
Based on code that used to be in examples/pylab_examples/filledmarker_demo.py
1 parent 4d0e2c5 commit 8f1339f

File tree

2 files changed

+29
-1
lines changed

2 files changed

+29
-1
lines changed

lib/matplotlib/tests/test_lines.py

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
unicode_literals)
66

77
from matplotlib.externals import six
8-
8+
import itertools
99
import matplotlib.lines as mlines
1010
import nose
1111
from nose.tools import assert_true, assert_raises
@@ -127,6 +127,34 @@ def test_set_line_coll_dash_image():
127127
cs = ax.contour(np.random.randn(20, 30), linestyles=[(0, (3, 3))])
128128

129129

130+
@image_comparison(baseline_images=['marker_fill_styles'], remove_text=True,
131+
extensions=['png'])
132+
def test_marker_fill_styles():
133+
colors = itertools.cycle(['b', 'g', 'r', 'c', 'm', 'y', 'k'])
134+
altcolor = 'lightgreen'
135+
136+
y = np.array([1, 1])
137+
x = np.array([0, 9])
138+
fig, ax = plt.subplots()
139+
140+
for j, marker in enumerate(mlines.Line2D.filled_markers):
141+
for i, fs in enumerate(mlines.Line2D.fillStyles):
142+
color = next(colors)
143+
ax.plot(j * 10 + x, y + i + .5 * (j % 2),
144+
marker=marker,
145+
markersize=20,
146+
markerfacecoloralt=altcolor,
147+
fillstyle=fs,
148+
label=fs,
149+
linewidth=5,
150+
color=color,
151+
markeredgecolor=color,
152+
markeredgewidth=2)
153+
154+
ax.set_ylim([0, 7.5])
155+
ax.set_xlim([-5, 135])
156+
157+
130158
def test_nan_is_sorted():
131159
# Exercises issue from PR #2744 (NaN throwing warning in _is_sorted)
132160
line = mlines.Line2D([],[])

0 commit comments

Comments
 (0)