Skip to content

Commit c5bbfc7

Browse files
committed
Extended documentation for pandas.DataFrame.plot.box
1 parent 30e0006 commit c5bbfc7

File tree

1 file changed

+30
-3
lines changed

1 file changed

+30
-3
lines changed

pandas/plotting/_core.py

+30-3
Original file line numberDiff line numberDiff line change
@@ -3031,19 +3031,46 @@ def barh(self, x=None, y=None, **kwds):
30313031

30323032
def box(self, by=None, **kwds):
30333033
r"""
3034-
Boxplot
3034+
Make a box plot of the DataFrame columns.
3035+
3036+
This method draws a box and whisker for each series in the DataFrame
3037+
in a single chart. The boxes share the vertical axis, which
3038+
makes makes it easier to compare if they are similar in scale.
3039+
Box plots are useful because they clearly show the median,
3040+
quartiles and flier points in the data.
3041+
3042+
A consideration when using this chart is that the box and the whiskers
3043+
can overlap, which is very common when plotting small sets of data.
30353044
30363045
Parameters
30373046
----------
30383047
by : string or sequence
30393048
Column in the DataFrame to group by.
3040-
`**kwds` : optional
3041-
Additional keyword arguments are documented in
3049+
**kwds : optional
3050+
Additional keywords are documented in
30423051
:meth:`pandas.DataFrame.plot`.
30433052
30443053
Returns
30453054
-------
30463055
axes : :class:`matplotlib.axes.Axes` or numpy.ndarray of them
3056+
3057+
See Also
3058+
--------
3059+
:meth:`pandas.DataFrame.boxplot` : Another method to draw a box plot.
3060+
:meth:`pandas.Series.plot.box` : Draw a box plot from a Series object.
3061+
:func:`matplotlib.pyplot.boxplot`: Draw a box plot in matplotlib.
3062+
3063+
Examples
3064+
--------
3065+
Draw a box plot from a DataFrame with four columns of randomly
3066+
generated data.
3067+
3068+
.. plot::
3069+
:context: close-figs
3070+
3071+
>>> data = np.random.randint(0, 10, size=(25, 4))
3072+
>>> df = pd.DataFrame(data, columns=list('ABCD'))
3073+
>>> plot = df.plot.box()
30473074
"""
30483075
return self(kind='box', by=by, **kwds)
30493076

0 commit comments

Comments
 (0)