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

Skip to content

Commit 01b7b77

Browse files
committed
MNT : Changed labeling to maintain back-compatibility
changed labeling in cbook.box_plotstats to start at 1 to maintain back compatibility
1 parent 75f3155 commit 01b7b77

File tree

3 files changed

+3
-5
lines changed

3 files changed

+3
-5
lines changed

lib/matplotlib/axes/_axes.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3046,7 +3046,7 @@ def boxplot(self, x, notch=False, sym='b+', vert=True, whis=1.5,
30463046
# replace medians if necessary:
30473047
if usermedians is not None:
30483048
if (len(np.ravel(usermedians)) != len(bxpstats) or
3049-
np.shape(usermedians)[0] != len(bxpstats)):
3049+
np.shape(usermedians)[0] != len(bxpstats)):
30503050
medmsg = 'usermedians length not compatible with x'
30513051
raise ValueError(medmsg)
30523052
else:
@@ -3352,11 +3352,9 @@ def dopatch(xs, ys, **kwargs):
33523352
if not self._hold:
33533353
self.cla()
33543354
holdStatus = self._hold
3355-
33563355
for pos, width, stats in zip(positions, widths, bxpstats):
33573356
# try to find a new label
33583357
datalabels.append(stats.get('label', pos))
3359-
33603358
# fliers coords
33613359
flier_x = np.ones(len(stats['fliers'])) * pos
33623360
flier_y = stats['fliers']

lib/matplotlib/cbook.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1948,7 +1948,7 @@ def _compute_conf_interval(data, med, iqr, bootstrap):
19481948

19491949
ncols = len(X)
19501950
if labels is None:
1951-
labels = [str(i) for i in range(ncols)]
1951+
labels = [str(i) for i in range(1, ncols+1)]
19521952
elif len(labels) != ncols:
19531953
raise ValueError("Dimensions of labels and X must be compatible")
19541954

lib/matplotlib/tests/test_cbook.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ def setup(self):
122122
'q3': 14.85246294739361,
123123
'whishi': 27.899688243699629,
124124
'whislo': 0.042143774965502923,
125-
'label': 0
125+
'label': 1
126126
}
127127

128128
self.known_bootstrapped_ci = {

0 commit comments

Comments
 (0)