@@ -2835,19 +2835,86 @@ def line(self, x=None, y=None, **kwds):
28352835
28362836 def bar (self , x = None , y = None , ** kwds ):
28372837 """
2838- Vertical bar plot
2838+ Vertical bar plot.
2839+
2840+ A bar plot is a plot that presents categorical data with
2841+ rectangular bars with lengths proportional to the values that they
2842+ represent. A bar plot shows comparisons among discrete categories. One
2843+ axis of the plot shows the specific categories being compared, and the
2844+ other axis represents a measured value.
28392845
28402846 Parameters
28412847 ----------
2842- x, y : label or position, optional
2843- Coordinates for each point.
2844- `**kwds` : optional
2848+ x : label or position, optional
2849+ Allows plotting of one column versus another. If not specified,
2850+ the index of the DataFrame is used.
2851+ y : label or position, optional
2852+ Allows plotting of one column versus another. If not specified,
2853+ all numerical columns are used.
2854+ **kwds
28452855 Additional keyword arguments are documented in
28462856 :meth:`pandas.DataFrame.plot`.
28472857
28482858 Returns
28492859 -------
2850- axes : :class:`matplotlib.axes.Axes` or numpy.ndarray of them
2860+ axes : matplotlib.axes.Axes or np.ndarray of them
2861+ An ndarray is returned with one :class:`matplotlib.axes.Axes`
2862+ per column when ``subplots=True``.
2863+
2864+ See Also
2865+ --------
2866+ pandas.DataFrame.plot.barh : Horizontal bar plot.
2867+ pandas.DataFrame.plot : Make plots of a DataFrame.
2868+ matplotlib.pyplot.bar : Make a bar plot with matplotlib.
2869+
2870+ Examples
2871+ --------
2872+ Basic plot.
2873+
2874+ .. plot::
2875+ :context: close-figs
2876+
2877+ >>> df = pd.DataFrame({'lab':['A', 'B', 'C'], 'val':[10, 30, 20]})
2878+ >>> ax = df.plot.bar(x='lab', y='val', rot=0)
2879+
2880+ Plot a whole dataframe to a bar plot. Each column is assigned a
2881+ distinct color, and each row is nested in a group along the
2882+ horizontal axis.
2883+
2884+ .. plot::
2885+ :context: close-figs
2886+
2887+ >>> speed = [0.1, 17.5, 40, 48, 52, 69, 88]
2888+ >>> lifespan = [2, 8, 70, 1.5, 25, 12, 28]
2889+ >>> index = ['snail', 'pig', 'elephant',
2890+ ... 'rabbit', 'giraffe', 'coyote', 'horse']
2891+ >>> df = pd.DataFrame({'speed': speed,
2892+ ... 'lifespan': lifespan}, index=index)
2893+ >>> ax = df.plot.bar(rot=0)
2894+
2895+ Instead of nesting, the figure can be split by column with
2896+ ``subplots=True``. In this case, a :class:`numpy.ndarray` of
2897+ :class:`matplotlib.axes.Axes` are returned.
2898+
2899+ .. plot::
2900+ :context: close-figs
2901+
2902+ >>> axes = df.plot.bar(rot=0, subplots=True)
2903+ >>> axes[1].legend(loc=2) # doctest: +SKIP
2904+
2905+ Plot a single column.
2906+
2907+ .. plot::
2908+ :context: close-figs
2909+
2910+ >>> ax = df.plot.bar(y='speed', rot=0)
2911+
2912+ Plot only selected categories for the DataFrame.
2913+
2914+ .. plot::
2915+ :context: close-figs
2916+
2917+ >>> ax = df.plot.bar(x='lifespan', rot=0)
28512918 """
28522919 return self (kind = 'bar' , x = x , y = y , ** kwds )
28532920
0 commit comments