Skip to content

Commit 2775a7f

Browse files
committed
BUG : don't assume label in boxpplot_stat
If the user does not pass in a label, do not assign one. Fixes #3563
1 parent ef2ea6a commit 2775a7f

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

lib/matplotlib/cbook.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
unicode_literals)
1111

1212
import six
13-
from six.moves import xrange
13+
from six.moves import xrange, zip
14+
from itertools import repeat
1415

1516
import datetime
1617
import errno
@@ -1948,14 +1949,15 @@ def _compute_conf_interval(data, med, iqr, bootstrap):
19481949

19491950
ncols = len(X)
19501951
if labels is None:
1951-
labels = [str(i) for i in range(1, ncols+1)]
1952+
labels = repeat(None)
19521953
elif len(labels) != ncols:
19531954
raise ValueError("Dimensions of labels and X must be compatible")
19541955

19551956
for ii, (x, label) in enumerate(zip(X, labels), start=0):
19561957
# empty dict
19571958
stats = {}
1958-
stats['label'] = label
1959+
if label is not None:
1960+
stats['label'] = label
19591961

19601962
# arithmetic mean
19611963
stats['mean'] = np.mean(x)

0 commit comments

Comments
 (0)