- 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 make pylab.savefig() save image for 'maximized' window instead of default size in Matplotlib?
To save image for maximized window instead of default size, we can use the following Steps −
Create figure with figsize=(7.50, 3.50), using the figure() method.
Plot the lines using the plot() method with list, color=”red”, and linewidth=2.
Save the figure using the savefig() method.
To display the figure, use the show() method.
Example
from matplotlib import pyplot as plt plt.rcParams["figure.figsize"] = [7.50, 3.50] plt.rcParams["figure.autolayout"] = True fig = plt.figure() plt.plot([1, 3, 7, 3, 1], c="red", lw=2) plt.savefig("full_image.png") plt.show()
Output
- Related Articles
- How to change the default path for "save the figure" in Matplotlib?
- How to retrieve the list of supported file formats for Matplotlib savefig()function?
- How to save a figure remotely with pylab in Python?
- How to resize the background image to window size in Tkinter?
- How to set the matplotlib figure default size in ipython notebook?
- Change figure window title in pylab(Python)
- Creating an automatically maximized tkinter window
- How to check that pylab backend of Matplotlib runs inline?
- How to use different markers for different points in a Pylab scatter plot(Matplotlib)?
- How to create/save the image of a JavaFX pie chart without actually showing the window?
- How to save an array as a grayscale image with Matplotlib/Numpy?
- Initialize a window as maximized in Tkinter Python
- Matplotlib savefig with a legend outside the plot
- How to save Matplotlib 3d rotating plots?
- How to save an image with matplotlib.pyplot?

Advertisements