Skip to content

Commit fb0c10d

Browse files
authored
Merge pull request #19860 from timhoffm/doc-boxplot
Move "howto interpreting box plots" to boxplot docstring
2 parents dec22c2 + b982135 commit fb0c10d

File tree

2 files changed

+22
-19
lines changed

2 files changed

+22
-19
lines changed

doc/faq/howto_faq.rst

-19
Original file line numberDiff line numberDiff line change
@@ -494,25 +494,6 @@ you're all done issuing commands and you want to draw the figure now.
494494
per script, and harmonized the behavior of interactive mode, across most
495495
backends.
496496

497-
.. _howto-boxplot_violinplot:
498-
499-
Interpreting box plots and violin plots
500-
---------------------------------------
501-
502-
Tukey's :doc:`box plots </gallery/statistics/boxplot_demo>` (Robert McGill,
503-
John W. Tukey and Wayne A. Larsen: "The American Statistician" Vol. 32, No. 1,
504-
Feb., 1978, pp. 12-16) are statistical plots that provide useful information
505-
about the data distribution such as skewness. However, bar plots with error
506-
bars are still the common standard in most scientific literature, and thus, the
507-
interpretation of box plots can be challenging for the unfamiliar reader. The
508-
figure below illustrates the different visual features of a box plot.
509-
510-
.. figure:: ../_static/boxplot_explanation.png
511-
512-
:doc:`Violin plots </gallery/statistics/violinplot>` are closely related to box
513-
plots but add useful information such as the distribution of the sample data
514-
(density trace). Violin plots were added in Matplotlib 1.4.
515-
516497
.. _how-to-threads:
517498

518499
Working with threads

lib/matplotlib/axes/_axes.py

+22
Original file line numberDiff line numberDiff line change
@@ -3714,6 +3714,28 @@ def boxplot(self, x, notch=None, sym=None, vert=None, whis=None,
37143714
meanprops : dict, default: None
37153715
The style of the mean.
37163716
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.
37173739
"""
37183740

37193741
# Missing arguments default to rcParams.

0 commit comments

Comments
 (0)