- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
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 change the DPI of a Pandas Dataframe Plot in Matplotlib?
To change the DPI of a Pandas DataFrame plot, we can use rcParams to set the dot per inch.
Steps
- Set the figure size and adjust the padding between and around the subplots.
- Set the DPI values in .rcParams["figure.dpi"] = 120
- Create a Pandas dataframe to make a plot.
- Plot the dataframe.
- 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 plt.rcParams["figure.dpi"] = 120 data = pd.DataFrame({"column1": [4, 6, 7, 1, 8]}) data.plot() plt.show()
Output
- Related Articles
- How to plot a Pandas Dataframe with Matplotlib?
- How to plot certain rows of a Pandas dataframe using Matplotlib?
- How to plot an area in a Pandas dataframe in Matplotlib Python?
- Annotating points from a Pandas Dataframe in Matplotlib plot
- How to plot a Pandas multi-index dataFrame with all xticks (Matplotlib)?
- Frequency plot in Python/Pandas DataFrame using Matplotlib
- Python - Plot a Histogram for Pandas Dataframe with Matplotlib?
- Plot a Line Graph for Pandas Dataframe with Matplotlib?
- How to plot a time as an index value in a Pandas dataframe in Matplotlib?
- Plot multiple columns of Pandas dataframe on the bar chart in Matplotlib
- Python - Plot a Pie Chart for Pandas Dataframe with Matplotlib?
- How to surface plot/3D plot from a dataframe (Matplotlib)?
- How to change the order of Pandas DataFrame columns?
- How to change the color of a plot frame in Matplotlib?
- How to plot a kernel density plot of dates in Pandas using Matplotlib?

Advertisements