- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Frequency plot in Python/Pandas DataFrame using Matplotlib
To show a frequency plot in Python/Pandas dataframe using Matplotlib, we can take the following steps −
- Set the figure size and adjust the padding between and around the subplots.
- Create a figure and a set of subplots.
- Make a two-dimensional, size-mutable, potentially heterogeneous tabular data.
- Return a Series containing the counts of unique values.
- To display the figure, use show() method.
Example
import pandas as pd from matplotlib import pyplot as plt plt.rcParams["figure.figsize"] = [7.50, 3.50] plt.rcParams["figure.autolayout"] = True fig, ax = plt.subplots() df = pd.DataFrame({'numbers': [2, 4, 1, 4, 3, 2, 1, 3, 2, 4]}) df['numbers'].value_counts().plot(ax=ax, kind='bar', xlabel='numbers', ylabel='frequency') plt.show()
Output
- Related Articles
- Python - Plot a Histogram for Pandas Dataframe with Matplotlib?
- Python - Plot a Pie Chart for Pandas Dataframe with Matplotlib?
- How to plot an area in a Pandas dataframe in Matplotlib Python?
- How to plot certain rows of a Pandas dataframe using Matplotlib?
- Annotating points from a Pandas Dataframe in Matplotlib plot
- How to plot a Pandas Dataframe with Matplotlib?
- Plot a Line Graph for Pandas Dataframe with Matplotlib?
- How to plot CSV data using Matplotlib and Pandas in Python?
- How to change the DPI of a Pandas Dataframe Plot in Matplotlib?
- Plot multiple columns of Pandas dataframe on the bar chart in Matplotlib
- Python Pandas - Plot multiple data columns in a DataFrame?
- Python - Plot a Pandas DataFrame in a Line Graph
- Plot multiple columns of Pandas DataFrame using Seaborn
- How to plot a Pandas multi-index dataFrame with all xticks (Matplotlib)?
- Python - Draw a Scatter Plot for a Pandas DataFrame

Advertisements