Skip to content

Commit d8cf8f3

Browse files
committed
Revert renaming labels to tick_labels in boxplot_stats()
This is up for debate: I'm only +0.2 here. The renaming was done in #27901, which renamed the parameter `labels` to `tick_labels` for `boxplot()` and `bxp()`. One can take two views here: - If `boxplot_stats()` is specifically for the input of `bxp()`, one can justify the renaming as being consistent with the `bxp()` signature. Note however, that the returned dict still contains the key "label" for back-compatibility. So that brings us an inconsistency between the parameter name and the returned dict key. - One can alternatively view `boxplot_stats()` as a generic function to define box parameters. Here, we'd only have a general `label` for the boy and no information that this should be used as tick label. If we could make a clean transition and also rename the dict key, I would tend to go with the first view. But the inevitable inconsistency of the fist view let's me sway towards the second view, so that with the revert, we've effectively not touched `boxplot_stats()`.
1 parent 6368cc5 commit d8cf8f3

File tree

1 file changed

+7
-12
lines changed

1 file changed

+7
-12
lines changed

lib/matplotlib/cbook.py

+7-12
Original file line numberDiff line numberDiff line change
@@ -1126,8 +1126,7 @@ def _broadcast_with_masks(*args, compress=False):
11261126
return inputs
11271127

11281128

1129-
@_api.rename_parameter("3.9", "labels", "tick_labels")
1130-
def boxplot_stats(X, whis=1.5, bootstrap=None, tick_labels=None,
1129+
def boxplot_stats(X, whis=1.5, bootstrap=None, labels=None,
11311130
autorange=False):
11321131
r"""
11331132
Return a list of dictionaries of statistics used to draw a series of box
@@ -1162,14 +1161,10 @@ def boxplot_stats(X, whis=1.5, bootstrap=None, tick_labels=None,
11621161
Number of times the confidence intervals around the median
11631162
should be bootstrapped (percentile method).
11641163
1165-
tick_labels : array-like, optional
1164+
labels : list of str, optional
11661165
Labels for each dataset. Length must be compatible with
11671166
dimensions of *X*.
11681167
1169-
.. versionchanged:: 3.9
1170-
Renamed from *labels*, which is deprecated since 3.9
1171-
and will be removed in 3.11.
1172-
11731168
autorange : bool, optional (False)
11741169
When `True` and the data are distributed such that the 25th and 75th
11751170
percentiles are equal, ``whis`` is set to (0, 100) such that the
@@ -1245,13 +1240,13 @@ def _compute_conf_interval(data, med, iqr, bootstrap):
12451240
X = _reshape_2D(X, "X")
12461241

12471242
ncols = len(X)
1248-
if tick_labels is None:
1249-
tick_labels = itertools.repeat(None)
1250-
elif len(tick_labels) != ncols:
1251-
raise ValueError("Dimensions of tick_labels and X must be compatible")
1243+
if labels is None:
1244+
labels = itertools.repeat(None)
1245+
elif len(labels) != ncols:
1246+
raise ValueError("Dimensions of labels and X must be compatible")
12521247

12531248
input_whis = whis
1254-
for ii, (x, label) in enumerate(zip(X, tick_labels)):
1249+
for ii, (x, label) in enumerate(zip(X, labels)):
12551250

12561251
# empty dict
12571252
stats = {}

0 commit comments

Comments
 (0)