

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- 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 Questions & Answers
- 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 resize the background image to window size in Tkinter?
- How to save a figure remotely with pylab in Python?
- Creating an automatically maximized tkinter window
- Change figure window title in pylab(Python)
- How to set the matplotlib figure default size in ipython notebook?
- How to create/save the image of a JavaFX pie chart without actually showing the window?
- How to check that pylab backend of Matplotlib runs inline?
- Initialize a window as maximized in Tkinter Python
- How to save an array as a grayscale image with Matplotlib/Numpy?
- How to use different markers for different points in a Pylab scatter plot(Matplotlib)?
- How to use Matplotlib and Pylab Python CGI program?
- How to save an image with matplotlib.pyplot?
- Matplotlib savefig with a legend outside the plot
Advertisements