Skip to content

Commit 9093eaf

Browse files
4kxzjorisvandenbossche
authored andcommitted
DOC: update the pandas.DataFrame.plot.box docstring (#20373)
1 parent 8004eff commit 9093eaf

File tree

1 file changed

+35
-3
lines changed

1 file changed

+35
-3
lines changed

pandas/plotting/_core.py

+35-3
Original file line numberDiff line numberDiff line change
@@ -3046,19 +3046,51 @@ def barh(self, x=None, y=None, **kwds):
30463046

30473047
def box(self, by=None, **kwds):
30483048
r"""
3049-
Boxplot
3049+
Make a box plot of the DataFrame columns.
3050+
3051+
A box plot is a method for graphically depicting groups of numerical
3052+
data through their quartiles.
3053+
The box extends from the Q1 to Q3 quartile values of the data,
3054+
with a line at the median (Q2). The whiskers extend from the edges
3055+
of box to show the range of the data. The position of the whiskers
3056+
is set by default to 1.5*IQR (IQR = Q3 - Q1) from the edges of the
3057+
box. Outlier points are those past the end of the whiskers.
3058+
3059+
For further details see Wikipedia's
3060+
entry for `boxplot <https://en.wikipedia.org/wiki/Box_plot>`__.
3061+
3062+
A consideration when using this chart is that the box and the whiskers
3063+
can overlap, which is very common when plotting small sets of data.
30503064
30513065
Parameters
30523066
----------
30533067
by : string or sequence
30543068
Column in the DataFrame to group by.
3055-
`**kwds` : optional
3056-
Additional keyword arguments are documented in
3069+
**kwds : optional
3070+
Additional keywords are documented in
30573071
:meth:`pandas.DataFrame.plot`.
30583072
30593073
Returns
30603074
-------
30613075
axes : :class:`matplotlib.axes.Axes` or numpy.ndarray of them
3076+
3077+
See Also
3078+
--------
3079+
pandas.DataFrame.boxplot: Another method to draw a box plot.
3080+
pandas.Series.plot.box: Draw a box plot from a Series object.
3081+
matplotlib.pyplot.boxplot: Draw a box plot in matplotlib.
3082+
3083+
Examples
3084+
--------
3085+
Draw a box plot from a DataFrame with four columns of randomly
3086+
generated data.
3087+
3088+
.. plot::
3089+
:context: close-figs
3090+
3091+
>>> data = np.random.randn(25, 4)
3092+
>>> df = pd.DataFrame(data, columns=list('ABCD'))
3093+
>>> ax = df.plot.box()
30623094
"""
30633095
return self(kind='box', by=by, **kwds)
30643096

0 commit comments

Comments
 (0)