You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug]: Incorrect type annotation for legend handes? #26639
The handles parameter for mpl.legend.Legend is typed as Iterable[Artist], but I believe that legend handles can also be artist tuples to produce a combo legend annotation?
Code for reproduction
# This works anywayimportmatplotlibasmplimportmatplotlib.pyplotaspltf, ax=plt.subplots()
h1=mpl.lines.Line2D([], [])
h2=mpl.patches.Patch(alpha=.2)
ax.legend(handles=[(h1, h2)], labels=["combo artist"])
Actual outcome
MyPy error when I pass a list of artist tuples to mpl.legend.Legend.
Expected outcome
I think this is valid matplotlib?
Additional information
Sorry the bug report template isn't the ideal format for this.
Activity
TYP: Accept tuples in Legend handles list
TYP: Accept tuples in Legend handles list
TYP: Accept tuples in Legend handles list
TYP: Accept tuples in Legend handles list