- 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
How to plot histograms from dataframes in Pandas using Matplotlib?
To plot histograms against Pandas/Matplotlib, we can take the following steps −
- Set the figure size and adjust the padding between and around the subplots.
- Make a potentially hetrogeneous tabular data using Pandas dataframe.
- Use the dataframe to make a histogram.
- To display the figure, use show() method.
Example
from matplotlib import pyplot as plt import pandas as pd plt.rcParams["figure.figsize"] = [7.50, 3.50] plt.rcParams["figure.autolayout"] = True df = pd.DataFrame({'a': [1, 1, 1, 1, 3], 'b': [1, 1, 2, 1, 3], 'c': [2, 2, 2, 1, 3], 'd': [2, 1, 2, 1, 3], }) df.hist() plt.show()
Output
- Related Articles
- Plot multiple time-series DataFrames into a single plot using Pandas (Matplotlib)
- How to plot multiple histograms on same plot with Seaborn using Matplotlib?
- How to plot two histograms side by side using Matplotlib?
- Plot 95% confidence interval errorbar Python Pandas dataframes in Matplotlib
- Plotting Pandas DataFrames in Pie Charts using Matplotlib
- Plotting histograms against classes in Pandas / Matplotlib
- Making matplotlib scatter plots from dataframes in Python's pandas
- How to plot a kernel density plot of dates in Pandas using Matplotlib?
- How to plot CSV data using Matplotlib and Pandas in Python?
- How to plot a bar graph in Matplotlib from a Pandas series?
- Frequency plot in Python/Pandas DataFrame using Matplotlib
- How to plot certain rows of a Pandas dataframe using Matplotlib?
- How to add legends and title to grouped histograms generated by Pandas? (Matplotlib)
- How to combine dataframes in Pandas?
- Annotating points from a Pandas Dataframe in Matplotlib plot

Advertisements