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

Skip to content

Commit 7d125cf

Browse files
committed
DOC: updated boxplot docstring
1 parent ee74cb8 commit 7d125cf

1 file changed

Lines changed: 104 additions & 117 deletions

File tree

lib/matplotlib/axes/_axes.py

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

0 commit comments

Comments
 (0)