Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit c7bcf69

Browse files
committed
add test
1 parent 8c6f70c commit c7bcf69

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

lib/matplotlib/tests/test_legend.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import matplotlib as mpl
1111
import matplotlib.transforms as mtransforms
1212
import matplotlib.collections as mcollections
13+
import matplotlib.lines as mlines
1314
from matplotlib.legend_handler import HandlerTuple
1415
import matplotlib.legend as mlegend
1516
from matplotlib.cbook.deprecation import MatplotlibDeprecationWarning
@@ -539,3 +540,14 @@ def test_draggable():
539540
with pytest.warns(MatplotlibDeprecationWarning):
540541
legend.draggable()
541542
assert not legend.get_draggable()
543+
544+
545+
def test_handlerline2d():
546+
'''Test consistency of the marker for the (monolithic) Line2D legend
547+
handler (see #11357).
548+
'''
549+
fig, ax = plt.subplots()
550+
ax.scatter([0, 1], [0, 1], marker="v")
551+
handles = [mlines.Line2D([0], [0], marker="v")]
552+
leg = ax.legend(handles, ["Aardvark"], numpoints=1)
553+
assert handles[0].get_marker() == leg.legendHandles[0].get_marker()

0 commit comments

Comments
 (0)