diff --git a/lib/matplotlib/legend_handler.py b/lib/matplotlib/legend_handler.py index 2d5f4aa78d89..fccf31d4b414 100644 --- a/lib/matplotlib/legend_handler.py +++ b/lib/matplotlib/legend_handler.py @@ -265,7 +265,7 @@ def get_numpoints(self, legend): return self._numpoints def _default_update_prop(self, legend_handle, orig_handle): - lw = orig_handle.get_linewidth()[0] + lw = orig_handle.get_linewidths()[0] dashes = orig_handle.get_dashes()[0] color = orig_handle.get_colors()[0] legend_handle.set_color(color) diff --git a/lib/matplotlib/tests/test_axes.py b/lib/matplotlib/tests/test_axes.py index 8203c0ad3a03..bda8822a78da 100644 --- a/lib/matplotlib/tests/test_axes.py +++ b/lib/matplotlib/tests/test_axes.py @@ -4820,6 +4820,12 @@ def test_scatter_color_masking(): assert linewidths[1] == 3 +@cleanup +def test_eventplot_legend(): + plt.eventplot([1.0], label='Label') + plt.legend() + + if __name__ == '__main__': import nose import sys