Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit b32632e

Browse filesBrowse files
authored
Merge pull request #23822 from meeseeksmachine/auto-backport-of-pr-23813-on-v3.6.x
Backport PR #23813 on branch v3.6.x (Triplot duplicated label)
2 parents f394755 + 713d13c commit b32632e
Copy full SHA for b32632e

File tree

Expand file treeCollapse file tree

2 files changed

+13
-0
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+13
-0
lines changed

‎lib/matplotlib/tests/test_triangulation.py

Copy file name to clipboardExpand all lines: lib/matplotlib/tests/test_triangulation.py
+12Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1299,3 +1299,15 @@ def test_triplot_with_ls(fig_test, fig_ref):
12991299
data = [[0, 1, 2]]
13001300
fig_test.subplots().triplot(x, y, data, ls='--')
13011301
fig_ref.subplots().triplot(x, y, data, linestyle='--')
1302+
1303+
1304+
def test_triplot_label():
1305+
x = [0, 2, 1]
1306+
y = [0, 0, 1]
1307+
data = [[0, 1, 2]]
1308+
fig, ax = plt.subplots()
1309+
lines, markers = ax.triplot(x, y, data, label='label')
1310+
handles, labels = ax.get_legend_handles_labels()
1311+
assert labels == ['label']
1312+
assert len(handles) == 1
1313+
assert handles[0] is lines

‎lib/matplotlib/tri/triplot.py

Copy file name to clipboardExpand all lines: lib/matplotlib/tri/triplot.py
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ def triplot(ax, *args, **kwargs):
7777
**kw,
7878
'linestyle': 'None', # No line to draw.
7979
}
80+
kw_markers.pop('label', None)
8081
if marker not in [None, 'None', '', ' ']:
8182
tri_markers = ax.plot(x, y, **kw_markers)
8283
else:

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.