How do I change the size of the picture made of matplotlib?

Asked 1 years ago, Updated 1 years ago, 99 views

How can I change the size of the picture made with matplotlib? Without overwriting or creating anything new!

python graph matplotlib plot visualization

2022-09-21 22:03

1 Answers

If you already have an image file, You can resize the canvas in the following ways:

import matplotlib.pyplot

fig = matplotlib.pyplot.gcf() #Bring into the current figure
Fig.set_size_inches (18.5, 10.5) #Size (in inches)
figure.savefig('test2png.png',dpi=100) #SaveCurrentFigure

set_size_inches(w, h, forward=False) changes the size of the figure in inches. When set to forward=True, the canvas size is automatically updated (reflected directly from the gui window you are using).


2022-09-21 22:03

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.