Closed
Description
Trying to add a legend to an event gives TypeError: 'float' object is not subscriptable
. Reason is that in legend_handler.HandlerLineCollection._default_update_prop
(link) in the call to lw = orig_handle.get_linewidth()[0]
subscripting happens twice (the return of get_linewidth()
already has [0]
applied). Removing [0]
fixes the issue.
There is no pull request as I do not know if this fix will break something somewhere else.
from matplotlib import pyplot as plt
plt.eventplot([11.0], label='Label')
plt.legend()
plt.show()
Version: matplotlib 1.5.3, Python 3.5.2 32 bit
Distro: winpython
Did also not work on mpl 1.4.3/Python 2.7