- 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 do you improve Matplotlib image quality?
To improve matplotlib image quality we can use greater dot per inch i.e dpi value (greater than 600) and pdf or .eps format can be recommended.
Steps
- Set the figure size and adjust the padding between and around the subplots.
- Make a 2D data raster using a np.array.
- Display data as an image, i.e., on a 2D regular raster.
- Save the current image using savefig() with dpi=1200 and .eps format,
- To display the figure, use show() method.
Example
import numpy as np from matplotlib import pyplot as plt plt.rcParams["figure.figsize"] = [7.50, 3.50] plt.rcParams["figure.autolayout"] = True data = np.array( [[0.1, 0.7, 0.6, 0.3], [0.2, 0.6, 0.5, 0.2], [0.8, 0.3, 0.80, 0.01], [0.3, 0.4, 0.2, 0.1]] ) plt.imshow(data, interpolation="nearest", cmap="RdYlGn_r") plt.savefig("myimage.eps", dpi=1200) plt.show()
Output
- Related Articles
- How do you directly overlay a scatter plot on top of a jpg image in Matplotlib?
- What are the general techniques to improve the quality of service?
- How to increase colormap/linewidth quality in streamplot Matplotlib?
- How do I redraw an image using Python's Matplotlib?
- How to improve the label placement for Matplotlib scatter chart?
- How do you determine which backend is being used by matplotlib?
- How do you create line segments between two points in Matplotlib?
- How do modules improve monolithic and micro kernel approaches?
- Maintain Image Quality When Applying CSS Transform & Scale
- How do you create a legend for a contour plot in Matplotlib?
- How much willing you are to improve traffic conditions in India?
- How do you change the default font color for all text in Matplotlib?
- How do you get the current figure number in Python's Matplotlib?
- How do you just show the text label in a plot legend in Matplotlib?
- When the soil is too basic, plants do not grow well in it. To improve its quality what must be added to the soil?Organic matterQuicklimeSlaked limeCalamine solution

Advertisements