Skip to content

Commit 2951083

Browse files
committed
Switch to asciiart for boxplot illustration.
This makes the information also available at the terminal.
1 parent fb0c10d commit 2951083

File tree

2 files changed

+28
-35
lines changed

2 files changed

+28
-35
lines changed

doc/_static/boxplot_explanation.png

-238 KB
Binary file not shown.

lib/matplotlib/axes/_axes.py

+28-35
Original file line numberDiff line numberDiff line change
@@ -3550,26 +3550,38 @@ def boxplot(self, x, notch=None, sym=None, vert=None, whis=None,
35503550
meanprops=None, capprops=None, whiskerprops=None,
35513551
manage_ticks=True, autorange=False, zorder=None):
35523552
"""
3553-
Make a box and whisker plot.
3553+
Draw a box and whisker plot.
3554+
3555+
The box extends from the first quartile (Q1) to the third
3556+
quartile (Q3) of the data, with a line at the median. The
3557+
whiskers extend from the box by 1.5x the inter-quartile range
3558+
(IQR). Flier points are those past the end of the whiskers.
3559+
See https://en.wikipedia.org/wiki/Box_plot for reference.
3560+
3561+
.. code-block:: none
3562+
3563+
Q1-1.5IQR Q1 median Q3 Q3+1.5IQR
3564+
|-----:-----|
3565+
o |--------| : |--------| o o
3566+
|-----:-----|
3567+
flier <-----------> fliers
3568+
IQR
35543569
3555-
Make a box and whisker plot for each column of *x* or each
3556-
vector in sequence *x*. The box extends from the lower to
3557-
upper quartile values of the data, with a line at the median.
3558-
The whiskers extend from the box to show the range of the
3559-
data. Flier points are those past the end of the whiskers.
35603570
35613571
Parameters
35623572
----------
35633573
x : Array or a sequence of vectors.
3564-
The input data.
3574+
The input data. If a 2D array, a boxplot is drawn for each column
3575+
in *x*. If a sequence of 1D arrays, a boxplot is drawn for each
3576+
array in *x*.
35653577
35663578
notch : bool, default: False
3567-
Whether to draw a notched box plot (`True`), or a rectangular box
3568-
plot (`False`). The notches represent the confidence interval (CI)
3569-
around the median. The documentation for *bootstrap* describes how
3570-
the locations of the notches are computed by default, but their
3571-
locations may also be overridden by setting the *conf_intervals*
3572-
parameter.
3579+
Whether to draw a notched boxplot (`True`), or a rectangular
3580+
boxplot (`False`). The notches represent the confidence interval
3581+
(CI) around the median. The documentation for *bootstrap*
3582+
describes how the locations of the notches are computed by
3583+
default, but their locations may also be overridden by setting the
3584+
*conf_intervals* parameter.
35733585
35743586
.. note::
35753587
@@ -3714,28 +3726,9 @@ def boxplot(self, x, notch=None, sym=None, vert=None, whis=None,
37143726
meanprops : dict, default: None
37153727
The style of the mean.
37163728
3717-
Notes
3718-
-----
3719-
Box plots provide insight into distribution properties of the data.
3720-
However, they can be challenging to interpret for the unfamiliar
3721-
reader. The figure below illustrates the different visual features of
3722-
a box plot.
3723-
3724-
.. image:: /_static/boxplot_explanation.png
3725-
:alt: Illustration of box plot features
3726-
:scale: 50 %
3727-
3728-
The whiskers mark the range of the non-outlier data. The most common
3729-
definition of non-outlier is ``[Q1 - 1.5xIQR, Q3 + 1.5xIQR]``, which
3730-
is also the default in this function. Other whisker meanings can be
3731-
applied via the *whis* parameter.
3732-
3733-
See `Box plot <https://en.wikipedia.org/wiki/Box_plot>`_ on Wikipedia
3734-
for further information.
3735-
3736-
Violin plots (`~.Axes.violinplot`) add even more detail about the
3737-
statistical distribution by plotting the kernel density estimation
3738-
(KDE) as an estimation of the probability density function.
3729+
See Also
3730+
--------
3731+
violinplot : Draw an estimate of the probability density function.
37393732
"""
37403733

37413734
# Missing arguments default to rcParams.

0 commit comments

Comments
 (0)