- 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
Saving images in Python at a very high quality
To save the images in Python with very high quality, you need to follow the steps given below −
Create fig and ax variables using subplots method, where default nrows and ncols are 1.
Plot the lines using plot() method.
We can add axes labels using ylabel() and xlabel().
To get a high-quality image, we can use .eps image format.
You can increase the dot per inch value, i.e., dpi.
Using savefig() method, we can save the image locally.
To show the figure, use plt.show().
Example
import matplotlib.pyplot as plt fig, ax = plt.subplots() plt.plot([0, 5], [0, 5]) plt.ylabel("Y-axis ") plt.xlabel("X-axis ") image_format = 'eps' # e.g .png, .svg, etc. image_name = 'myimage.eps' fig.savefig(image_name, format=image_format, dpi=1200)
Output
- Related Articles
- The ultrasound waves can penetrate into matter to a large extent because they have:(a) very high speed (b) very high frequency(c) very high wavelength(d) very high amplitude
- Difference Between HQ (High Quality) and HD (High Definition)
- The sky appears dark to passengers flying at very high altitudes mainly because-
- Why are road accidents at high speeds very much worse than road accidents at low speeds?
- Name a non-metal having a very high melting point.
- Top Twenty Sites with Free High Resolution Images
- Saving a 3D-plot in a PDF 3D with Python
- Saving all the open Matplotlib figures in one file at once
- Working with Images in Python?
- Generating a movie from Python without saving individual frames to files
- Although wood has a very high calorific value, we still discourage its use as a fuel. Explain.
- Reading images using Python?
- How to talk to my neighbors who keep their TV volume very high?
- When an electric bulb gets heated to a very large high temperature, in which color it turns to?
- How to compress Python objects before saving to cache?

Advertisements