8000 add eventplot test to axes tests · matplotlib/matplotlib@1a11551 · GitHub
[go: up one dir, main page]

Skip to content

Commit 1a11551

Browse files
committed
add eventplot test to axes tests
1 parent 3dc54a6 commit 1a11551

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

lib/matplotlib/tests/test_axes.py

Lines changed: 38 additions & 0 deletions
8000
Original file line numberDiff line numberDiff line change
@@ -1106,6 +1106,44 @@ def test_alpha():
11061106
markersize=20, lw=10)
11071107

11081108

1109+
@image_comparison(baseline_images=['eventplot'], remove_text=True)
1110+
def test_eventplot():
1111+
'''
1112+
test that eventplot produces the correct output
1113+
'''
1114+
np.random.seed(0)
1115+
1116+
data1 = np.random.random([32, 20]).tolist()
1117+
data2 = np.random.random([6, 20]).tolist()
1118+
data = data1 + data2
1119+
num_datasets = len(data)
1120+
1121+
colors1 = [[0, 1, .7]] * len(data1)
1122+
colors2 = [[1, 0, 0],
1123+
[0, 1, 0],
1124+
[0, 0, 1],
1125+
[1, .75, 0],
1126+
[1, 0, 1],
1127+
[0, 1, 1]]
1128+
colors = colors1 + colors2
1129+
1130+
lineoffsets1 = 12 + np.arange(0, len(data1)) * .33
1131+
lineoffsets2 = [-15, -3, 1, 1.5, 6, 10]
1132+
lineoffsets = lineoffsets1.tolist() + lineoffsets2
1133+
1134+
linelengths1 = [.33] * len(data1)
1135+
linelengths2 = [5, 2, 1, 1, 3, 1.5]
1136+
linelengths = linelengths1 + linelengths2
1137+
1138+
fig = plt.figure()
1139+
axobj = fig.add_subplot(111)
1140+
colls = axobj.eventplot(data, colors=colors, lineoffsets=lineoffsets,
1141+
linelengths=linelengths)
1142+
1143+
num_collections = len(colls)
1144+
np.testing.assert_equal(num_collections, num_datasets)
1145+
1146+
11091147
@image_comparison(baseline_images=['vline_hline_zorder',
11101148
'errorbar_zorder'])
11111149
def test_eb_line_zorder():

0 commit comments

Comments
 (0)
0