8000 eventplot legend fails (linewidth) · Issue #7662 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content
eventplot legend fails (linewidth) #7662
Closed
@nepix32

Description

@nepix32

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    0