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 |
---|---|---|---|
x | Column to be used for categories. | label or position Default Value: DataFrame.index |
Required |
y | 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
- New Content published on w3resource:
- HTML-CSS Practical: Exercises, Practice, Solution
- Java Regular Expression: Exercises, Practice, Solution
- Scala Programming Exercises, Practice, Solution
- Python Itertools exercises
- Python Numpy exercises
- Python GeoPy Package exercises
- Python Pandas exercises
- Python nltk exercises
- Python BeautifulSoup exercises
- Form Template
- Composer - PHP Package Manager
- PHPUnit - PHP Testing
- Laravel - PHP Framework
- Angular - JavaScript Framework
- Vue - JavaScript Framework
- Jest - JavaScript Testing Framework