9951 explained code solutions for 126 technologies


python-matplotlibHow to set image size


In order to set exported image size, we need to modify dpi param to configure resolution in pixels per inch:

import matplotlib.pyplot as plt
plt.plot([1,3,2])
plt.savefig('plot.png', dpi=500)ctrl + c
import matplotlib.pyplot as plt

loads Matplotlib module to use plotting capabilities

.plot(

plot specified data

savefig(

saves chart to the specified image file

plot.png

image file to save chart to

dpi=

modify image size by setting dots per inch