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

Skip to content

Commit 54755bc

Browse files
afvincentanntzer
authored andcommitted
add test
1 parent 0abac25 commit 54755bc

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

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 import rc_context
@@ -861,3 +862,14 @@ def test_legend_text_axes():
861862

862863
assert leg.axes is ax
863864
assert leg.get_texts()[0].axes is ax
865+
866+
867+
def test_handlerline2d():
868+
'''Test consistency of the marker for the (monolithic) Line2D legend
869+
handler (see #11357).
870+
'''
871+
fig, ax = plt.subplots()
872+
ax.scatter([0, 1], [0, 1], marker="v")
873+
handles = [mlines.Line2D([0], [0], marker="v")]
874+
leg = ax.legend(handles, ["Aardvark"], numpoints=1)
875+
assert handles[0].get_marker() == leg.legendHandles[0].get_marker()

0 commit comments

Comments
 (0)