We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 109e759 commit a16f8d0Copy full SHA for a16f8d0
lib/matplotlib/tests/test_legend.py
@@ -297,13 +297,18 @@ def test_legend_remove():
297
def test_reverse_legend():
298
fig, ax = plt.subplots()
299
x = [1, 2, 3]
300
- y = [1, 2, 3], [2, 3, 4], [3, 4, 5]
+ y = [[1, 2, 3], [2, 3, 4], [3, 4, 5]]
301
labels = ["First label", "Second label", "Third label"]
302
+ markers = ['.', ',', 'o']
303
- ax.plot(x, y, label=labels)
304
+ ax.plot(x, y[0], markers[0], label=labels[0])
305
+ ax.plot(x, y[1], markers[1], label=labels[1])
306
+ ax.plot(x, y[2], markers[2], label=labels[2])
307
leg = ax.legend(reverse=True)
- actual_labels = [t.get_gext() for t in leg.get_texts()]
- assert actual_labels == list(reversed(labels))
308
+ actual_labels = [t.get_text() for t in leg.get_texts()]
309
+ actual_markers = [h.get_marker() for h in leg.legend_handles]
310
+ assert (actual_labels, actual_markers) == (list(reversed(labels)),
311
+ (list(reversed(markers))))
312
313
314
class TestLegendFunction:
0 commit comments