w3resource

Pandas DataFrame: plot.barh() function

DataFrame.plot.barh() function

The plot.barh() function is used to make a horizontal bar plot.

A horizontal bar plot is a plot that presents quantitative data with rectangular bars with lengths proportional to the values that they represent. A bar plot shows comparisons among discrete categories. One axis of the plot shows the specific categories being compared, and the other axis represents a measured value.

Syntax:

DataFrame.plot.barh(self, x=None, y=None, **kwargs)

Parameters:

Name Description Type/Default Value Required / Optional
Column to be used for categories. label or position
Default Value: DataFrame.index
Required
Columns to be plotted from the DataFrame. label or position
Default Value: All numeric columns in dataframe
Required
**kwds  Keyword arguments to pass on to DataFrame.plot().   Required

Returns: matplotlib.axes.Axes or numpy.ndarray of them

Example:


Download the Pandas DataFrame Notebooks from here.

Previous: DataFrame.plot.bar() function
Next: DataFrame.plot.box() function



Become a Patron!

Follow us on Facebook and Twitter for latest update.

It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.

https://w3resource.com/pandas/dataframe/dataframe-plot-barh.php