April 2018
Beginner to intermediate
300 pages
7h 34m
English
plt.savefig() automatically detects the file extension of the specified output path, and generates the corresponding file format if it is supported. If no file extension is specified in the input, a PNG format file would be obtained as output with the default backend. This supports a number of image formats, including PNG, JPG, PDF, and PostScript:
import numpy as npimport matplotlib.pyplot as plty = np.linspace(1,2000)x = 1.0/np.sin(y)plt.plot(x,y,'green')plt.xlim(-20,20)plt.ylim(1000,2400)plt.show()plt.savefig('123')
Read now
Unlock full access