Skip to content

Commit 8e96d30

Browse files
committed
Clarify the uses of whiskers float parameter.
It is not clear (at least to a couple of non-native English speakers) that the whiskers extend to the last data point. More precisely: > "If it's 1.5 times Q3-Q1 it should be symmetric" The code does seem to limit the whisker to the last data point, and that correspond to one of the usage of whiskers described by Wikipedia. So fix docstrings.
1 parent 1fa4dd7 commit 8e96d30

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

lib/matplotlib/axes/_axes.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3126,9 +3126,11 @@ def boxplot(self, x, notch=None, sym=None, vert=None, whis=None,
31263126
everything is drawn horizontally.
31273127
31283128
whis : float, sequence, or string (default = 1.5)
3129-
As a float, determines the reach of the whiskers past the
3130-
first and third quartiles (e.g., Q3 + whis*IQR,
3131-
IQR = interquartile range, Q3-Q1). Beyond the whiskers, data
3129+
As a float, determines the reach of the whiskers to the first
3130+
(resp. last) datum past the first (resp. third) quartiles
3131+
(e.g., Q3 + whis*IQR, IQR = interquartile range, Q3-Q1, whisker
3132+
will be at last data point less than Q3 + whis*IQR).
3133+
Beyond the whiskers, data
31323134
are considered outliers and are plotted as individual
31333135
points. Set this to an unreasonably high value to force the
31343136
whiskers to show the min and max values. Alternatively, set

lib/matplotlib/cbook.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1872,9 +1872,11 @@ def boxplot_stats(X, whis=1.5, bootstrap=None, labels=None,
18721872
fewer dimensions.
18731873
18741874
whis : float, string, or sequence (default = 1.5)
1875-
As a float, determines the reach of the whiskers past the first
1876-
and third quartiles (e.g., Q3 + whis*IQR, QR = interquartile
1877-
range, Q3-Q1). Beyond the whiskers, data are considered outliers
1875+
As a float, determines the reach of the whiskers to the first (resp.
1876+
last) datum past the first (resp. third) quartiles
1877+
(e.g., Q3 + whis*IQR, IQR = interquartile range, Q3-Q1, whisker will
1878+
be at last data point less than Q3 + whis*IQR).
1879+
Beyond the whiskers, data are considered outliers
18781880
and are plotted as individual points. This can be set this to an
18791881
ascending sequence of percentile (e.g., [5, 95]) to set the
18801882
whiskers at specific percentiles of the data. Finally, `whis`

0 commit comments

Comments
 (0)