9951 explained code solutions for 126 technologies


python-matplotlibHow to only save image


import matplotlib.pyplot as plt
plt.plot([1,3,2])
plt.savefig('plot.png')
plt.close()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

.close()

we don't want to do anything else