Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Commitaf43359

Browse files
committed
FIX: single label per boxplot
1 parentdb5fe9a commitaf43359

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

‎lib/matplotlib/axes/_axes.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4004,9 +4004,6 @@ def boxplot(self, x, notch=None, sym=None, vert=None, whis=None,
40044004
if'color'inboxprops:
40054005
boxprops['edgecolor']=boxprops.pop('color')
40064006

4007-
iflabels:
4008-
boxprops['label']=labels
4009-
40104007
# if non-default sym value, put it into the flier dictionary
40114008
# the logic for providing the default symbol ('b+') now lives
40124009
# in bxp in the initial value of flierkw
@@ -4280,6 +4277,7 @@ def do_patch(xs, ys, **kwargs):
42804277
capwidths):
42814278
# try to find a new label
42824279
datalabels.append(stats.get('label',pos))
4280+
box_kw['label']=stats.get('label',None)
42834281

42844282
# whisker coords
42854283
whis_x= [pos,pos]

‎lib/matplotlib/tests/test_legend.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1465,3 +1465,13 @@ def test_boxplot_legend():
14651465
asserthandle.get_facecolor()==colors[index]
14661466
asserthandle.get_edgecolor()==colors[index]
14671467
asserthandle.get_label()==labels[index]
1468+
1469+
1470+
deftest_boxplot_multi_label():
1471+
# Smoke test that we can pass a 2D array and sequence of labels.
1472+
fig,ax=plt.subplots()
1473+
1474+
A=np.arange(30).reshape(10,3)
1475+
labels= ['a','b','c']
1476+
1477+
ax.boxplot(A,labels=labels)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp