Skip to content

Commit ec2eeab

Browse files
committed
DOC: updated boxplot docstring
1 parent 5200045 commit ec2eeab

File tree

1 file changed

+100
-114
lines changed

1 file changed

+100
-114
lines changed

lib/matplotlib/axes/_axes.py

Lines changed: 100 additions & 114 deletions
Original file line numberDiff line numberDiff line change
@@ -3038,10 +3038,10 @@ def boxplot(self, x, notch=None, sym=None, vert=None, whis=None,
30383038
positions=None, widths=None, patch_artist=None,
30393039
bootstrap=None, usermedians=None, conf_intervals=None,
30403040
meanline=None, showmeans=None, showcaps=None,
3041-
showbox=None, showfliers=None, boxprops=None, labels=None,
3042-
flierprops=None, medianprops=None, meanprops=None,
3043-
capprops=None, whiskerprops=None, manage_xticks=True,
3044-
autorange=False):
3041+
showbox=None, showfliers=None, boxprops=None,
3042+
labels=None, flierprops=None, medianprops=None,
3043+
meanprops=None, capprops=None, whiskerprops=None,
3044+
manage_xticks=True, autorange=False):
30453045
"""
30463046
Make a box and whisker plot.
30473047
@@ -3051,9 +3051,10 @@ def boxplot(self, x, notch=None, sym=None, vert=None, whis=None,
30513051
positions=None, widths=None, patch_artist=False,
30523052
bootstrap=None, usermedians=None, conf_intervals=None,
30533053
meanline=False, showmeans=False, showcaps=True,
3054-
showbox=True, showfliers=True, boxprops=None, labels=None,
3055-
flierprops=None, medianprops=None, meanprops=None,
3056-
capprops=None, whiskerprops=None, manage_xticks=True):
3054+
showbox=True, showfliers=True, boxprops=None,
3055+
labels=None, flierprops=None, medianprops=None,
3056+
meanprops=None, capprops=None, whiskerprops=None,
3057+
manage_xticks=True, autorange=False):
30573058
30583059
Make a box and whisker plot for each column of *x* or each
30593060
vector in sequence *x*. The box extends from the lower to
@@ -3063,121 +3064,105 @@ def boxplot(self, x, notch=None, sym=None, vert=None, whis=None,
30633064
30643065
Parameters
30653066
----------
3066-
3067-
x : Array or a sequence of vectors.
3067+
x : Array or a sequence of vectors.
30683068
The input data.
3069-
3070-
notch : bool, default = False
3071-
If False, produces a rectangular box plot.
3072-
If True, will produce a notched box plot
3073-
3074-
sym : str or None, default = None
3075-
The default symbol for flier points.
3076-
Enter an empty string ('') if you don't want to show fliers.
3077-
If `None`, then the fliers default to 'b+' If you want more
3078-
control use the flierprops kwarg.
3079-
3080-
vert : bool, default = True
3081-
If True (default), makes the boxes vertical.
3082-
If False, makes horizontal boxes.
3083-
3084-
whis : float, sequence (default = 1.5) or string
3085-
As a float, determines the reach of the whiskers past the first
3086-
and third quartiles (e.g., Q3 + whis*IQR, IQR = interquartile
3087-
range, Q3-Q1). Beyond the whiskers, data are considered outliers
3088-
and are plotted as individual points. Set this to an unreasonably
3089-
high value to force the whiskers to show the min and max values.
3090-
Alternatively, set this to an ascending sequence of percentile
3091-
(e.g., [5, 95]) to set the whiskers at specific percentiles of
3092-
the data. Finally, *whis* can be the string 'range' to force the
3093-
whiskers to the min and max of the data. In the edge case that
3094-
the 25th and 75th percentiles are equivalent, *whis* will be
3095-
automatically set to 'range'.
3096-
3097-
bootstrap : None (default) or integer
3069+
notch : bool, optional (False)
3070+
If `True`, will produce a notched box plot. Otherwise, a
3071+
rectangular boxplot is produced.
3072+
sym : str, optional
3073+
The default symbol for flier points. Enter an empty string
3074+
('') if you don't want to show fliers. If `None`, then the
3075+
fliers default to 'b+' If you want more control use the
3076+
flierprops kwarg.
3077+
vert : bool, optional (True)
3078+
If `True` (default), makes the boxes vertical. If `False`,
3079+
everything is drawn horizontally.
3080+
whis : float, sequence, or string (default = 1.5)
3081+
As a float, determines the reach of the whiskers past the
3082+
first and third quartiles (e.g., Q3 + whis*IQR,
3083+
IQR = interquartile range, Q3-Q1). Beyond the whiskers, data
3084+
are considered outliers and are plotted as individual
3085+
points. Set this to an unreasonably high value to force the
3086+
whiskers to show the min and max values. Alternatively, set
3087+
this to an ascending sequence of percentile (e.g., [5, 95])
3088+
to set the whiskers at specific percentiles of the data.
3089+
Finally, ``whis`` can be the string ``'range'`` to force the
3090+
whiskers to the min and max of the data. In the edge case
3091+
that the 25th and 75th percentiles are equivalent, *whis*
3092+
will be automatically set to ``'range'``.
3093+
bootstrap : int, optional
30983094
Specifies whether to bootstrap the confidence intervals
30993095
around the median for notched boxplots. If bootstrap==None,
31003096
no bootstrapping is performed, and notches are calculated
3101-
using a Gaussian-based asymptotic approximation (see McGill, R.,
3102-
Tukey, J.W., and Larsen, W.A., 1978, and Kendall and Stuart,
3103-
1967). Otherwise, bootstrap specifies the number of times to
3104-
bootstrap the median to determine it's 95% confidence intervals.
3105-
Values between 1000 and 10000 are recommended.
3106-
3107-
usermedians : array-like or None (default)
3097+
using a Gaussian-based asymptotic approximation (see McGill,
3098+
R., Tukey, J.W., and Larsen, W.A., 1978, and Kendall and
3099+
Stuart, 1967). Otherwise, bootstrap specifies the number of
3100+
times to bootstrap the median to determine its 95%
3101+
confidence intervals. Values between 1000 and 10000 are
3102+
recommended.
3103+
usermedians : array-like, optional
31083104
An array or sequence whose first dimension (or length) is
3109-
compatible with *x*. This overrides the medians computed by
3110-
matplotlib for each element of *usermedians* that is not None.
3111-
When an element of *usermedians* == None, the median will be
3112-
computed by matplotlib as normal.
3113-
3114-
conf_intervals : array-like or None (default)
3115-
Array or sequence whose first dimension (or length) is compatible
3116-
with *x* and whose second dimension is 2. When the current element
3117-
of *conf_intervals* is not None, the notch locations computed by
3118-
matplotlib are overridden (assuming notch is True). When an
3119-
element of *conf_intervals* is None, boxplot compute notches the
3120-
method specified by the other kwargs (e.g., *bootstrap*).
3121-
3122-
positions : array-like, default = [1, 2, ..., n]
3123-
Sets the positions of the boxes. The ticks and limits
3124-
are automatically set to match the positions.
3125-
3126-
widths : array-like, default = 0.5
3127-
Either a scalar or a vector and sets the width of each box. The
3128-
default is 0.5, or ``0.15*(distance between extreme positions)``
3129-
if that is smaller.
3130-
3131-
labels : sequence or None (default)
3132-
Labels for each dataset. Length must be compatible with
3133-
dimensions of *x*
3134-
3135-
patch_artist : bool, default = False
3136-
If False produces boxes with the Line2D artist
3137-
If True produces boxes with the Patch artist
3138-
3139-
showmeans : bool, default = False
3140-
If True, will toggle one the rendering of the means
3141-
3142-
showcaps : bool, default = True
3143-
If True, will toggle one the rendering of the caps
3144-
3145-
showbox : bool, default = True
3146-
If True, will toggle one the rendering of box
3147-
3148-
showfliers : bool, default = True
3149-
If True, will toggle one the rendering of the fliers
3150-
3151-
boxprops : dict or None (default)
3152-
If provided, will set the plotting style of the boxes
3153-
3154-
whiskerprops : dict or None (default)
3155-
If provided, will set the plotting style of the whiskers
3156-
3157-
capprops : dict or None (default)
3158-
If provided, will set the plotting style of the caps
3159-
3160-
flierprops : dict or None (default)
3161-
If provided, will set the plotting style of the fliers
3162-
3163-
medianprops : dict or None (default)
3164-
If provided, will set the plotting style of the medians
3165-
3166-
meanprops : dict or None (default)
3167-
If provided, will set the plotting style of the means
3168-
3169-
meanline : bool, default = False
3170-
If True (and *showmeans* is True), will try to render the mean
3171-
as a line spanning the full width of the box according to
3172-
*meanprops*. Not recommended if *shownotches* is also True.
3173-
Otherwise, means will be shown as points.
3174-
3175-
manage_xticks : bool, default = True
3105+
compatible with ``x``. This overrides the medians computed
3106+
by matplotlib for each element of *usermedians* that is not
3107+
`None`. When an element of *usermedians* == None, the median
3108+
will be computed by matplotlib as normal.
3109+
conf_intervals : array-like, optional
3110+
Array or sequence whose first dimension (or length) is
3111+
compatible with ``x`` and whose second dimension is 2. When
3112+
the current element of ``conf_intervals`` is not None, the
3113+
notch locations computed by matplotlib are overridden
3114+
(provided ``notch`` is `True`). When an element of
3115+
``conf_intervals`` is `None`, the notches are computed by the
3116+
method specified by the other kwargs (e.g., ``bootstrap``).
3117+
positions : array-like, optional
3118+
Sets the positions of the boxes. The ticks and limits are
3119+
automatically set to match the positions. Defaults to
3120+
`range(1, N+1)` where N is the number of boxes to be drawn.
3121+
widths : scalar or array-like
3122+
Sets the width of each box either with a scalar or a
3123+
sequence. The default is 0.5, or ``0.15*(distance between
3124+
extreme positions)``, if that is smaller.
3125+
patch_artist : bool, optional (False)
3126+
If `False` produces boxes with the Line2D artist. Otherwise,
3127+
boxes and drawn with Patch artists.
3128+
labels : sequence, optional
3129+
Labels for each dataset. Length must be compatible with
3130+
dimensions of ``x``.
3131+
manage_xticks : bool, optional (True)
31763132
If the function should adjust the xlim and xtick locations.
3133+
autorange : bool, optional (False)
3134+
When `True` and the data are distributed such that the 25th and
3135+
75th percentiles are equal, ``whis`` is set to ``'range'`` such
3136+
that the whisker ends are at the minimum and maximum of the
3137+
data.
3138+
meanline : bool, optional (False)
3139+
If `True` (and ``showmeans`` is True), will try to render
3140+
the mean as a line spanning the full width of the box
3141+
according to ``meanprops`` (see below). Not recommended if
3142+
``shownotches`` is also True. Otherwise, means will be shown
3143+
as points.
3144+
3145+
Additional Options
3146+
---------------------
3147+
The following boolean options toogle the drawing of individual
3148+
components of the boxplots:
3149+
- showcaps: the caps on the ends of whiskers
3150+
(default is True)
3151+
- showbox: the central box (default is True)
3152+
- showfliers: the outlierd beyone the caps (default is True)
3153+
- showmeans: the arithmetic means (default is False)
3154+
3155+
The remaining options can accept dictionaries that specify the
3156+
style of the individual artists:
3157+
- capprops
3158+
- boxprops
3159+
- whiskerprops
3160+
- flierprops
3161+
- medianprops
3162+
- meanprops
31773163
31783164
Returns
31793165
-------
3180-
31813166
result : dict
31823167
A dictionary mapping each component of the boxplot
31833168
to a list of the :class:`matplotlib.lines.Line2D`
@@ -3196,9 +3181,10 @@ def boxplot(self, x, notch=None, sym=None, vert=None, whis=None,
31963181
31973182
Examples
31983183
--------
3199-
32003184
.. plot:: mpl_examples/statistics/boxplot_demo.py
3185+
32013186
"""
3187+
32023188
# If defined in matplotlibrc, apply the value from rc file
32033189
# Overridden if argument is passed
32043190
if whis is None:

0 commit comments

Comments
 (0)