Skip to content

Commit 159f36e

Browse files
authored
Merge pull request #7676 from nepix32/nepix32-patch-1
Makes eventplot legend work
2 parents ba9908f + ad74d47 commit 159f36e

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

lib/matplotlib/legend_handler.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ def get_numpoints(self, legend):
267267
return self._numpoints
268268

269269
def _default_update_prop(self, legend_handle, orig_handle):
270-
lw = orig_handle.get_linewidth()[0]
270+
lw = orig_handle.get_linewidths()[0]
271271
dashes = orig_handle.get_dashes()[0]
272272
color = orig_handle.get_colors()[0]
273273
legend_handle.set_color(color)

lib/matplotlib/tests/test_axes.py

+6
Original file line numberDiff line numberDiff line change
@@ -4871,3 +4871,9 @@ def test_scatter_color_masking():
48714871
assert_array_equal(facecolors[1], np.array([0, 0, 0, 1]))
48724872
assert_array_equal(linecolors[1], np.array([0, 0, 0, 1]))
48734873
assert linewidths[1] == 3
4874+
4875+
4876+
@cleanup
4877+
def test_eventplot_legend():
4878+
plt.eventplot([1.0], label='Label')
4879+
plt.legend()

0 commit comments

Comments
 (0)