Skip to content

Commit e03b4b8

Browse files
4kxzjavadnoorb
authored andcommitted
DOC: update the pandas.DataFrame.plot.box docstring (pandas-dev#20373)
1 parent 4a77c96 commit e03b4b8

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
@@ -3060,19 +3060,51 @@ def barh(self, x=None, y=None, **kwds):
30603060

30613061
def box(self, by=None, **kwds):
30623062
r"""
3063-
Boxplot
3063+
Make a box plot of the DataFrame columns.
3064+
3065+
A box plot is a method for graphically depicting groups of numerical
3066+
data through their quartiles.
3067+
The box extends from the Q1 to Q3 quartile values of the data,
3068+
with a line at the median (Q2). The whiskers extend from the edges
3069+
of box to show the range of the data. The position of the whiskers
3070+
is set by default to 1.5*IQR (IQR = Q3 - Q1) from the edges of the
3071+
box. Outlier points are those past the end of the whiskers.
3072+
3073+
For further details see Wikipedia's
3074+
entry for `boxplot <https://en.wikipedia.org/wiki/Box_plot>`__.
3075+
3076+
A consideration when using this chart is that the box and the whiskers
3077+
can overlap, which is very common when plotting small sets of data.
30643078
30653079
Parameters
30663080
----------
30673081
by : string or sequence
30683082
Column in the DataFrame to group by.
3069-
`**kwds` : optional
3070-
Additional keyword arguments are documented in
3083+
**kwds : optional
3084+
Additional keywords are documented in
30713085
:meth:`pandas.DataFrame.plot`.
30723086
30733087
Returns
30743088
-------
30753089
axes : :class:`matplotlib.axes.Axes` or numpy.ndarray of them
3090+
3091+
See Also
3092+
--------
3093+
pandas.DataFrame.boxplot: Another method to draw a box plot.
3094+
pandas.Series.plot.box: Draw a box plot from a Series object.
3095+
matplotlib.pyplot.boxplot: Draw a box plot in matplotlib.
3096+
3097+
Examples
3098+
--------
3099+
Draw a box plot from a DataFrame with four columns of randomly
3100+
generated data.
3101+
3102+
.. plot::
3103+
:context: close-figs
3104+
3105+
>>> data = np.random.randn(25, 4)
3106+
>>> df = pd.DataFrame(data, columns=list('ABCD'))
3107+
>>> ax = df.plot.box()
30763108
"""
30773109
return self(kind='box', by=by, **kwds)
30783110

0 commit comments

Comments
 (0)