+2 votes
in Python by (10.2k points)
edited by

Can someone tell me any methods change the size of figures drawn with matploatlib?

2 Answers

0 votes
by (2k points)
edited by

It's a very simple task to perform, just use figure and it will tell you the call signature:

from matplotlib.pyplot import figure
figure(num=None, figsize=(3, 4), dpi=80, facecolor='k', edgecolor='w')

(1,1,) in figsize will create a inch-by-inch plot and it'll be of 80-by-80 (defined in dpi) pixels. 

0 votes
by (107k points)

You can use below-mentioned code to change the figure drawn with matplotlib:-

fig = matplotlib.pyplot.gcf()

fig.set_size_inches(18.5, 10.5)

fig.savefig('test2png.png', dpi=100)

To propagate the size change to an existing GUI window add forward=True

fig.set_size_inches(18.5, 10.5, forward=True)

You can use the following video tutorials to clear all your doubts:-

Related questions

Welcome to Intellipaat Community. Get your technical queries answered by top developers !