December 2017
Intermediate to advanced
386 pages
10h 42m
English
To save a plot to disk, we use the savefig() function, as illustrated in the following code segment:
plt.figure(figsize=(4,4))tvalues = np.linspace(-np.pi, np.pi, 500)xvalues = 2*np.cos(tvalues)-np.cos(2*tvalues)yvalues = 2*np.sin(tvalues)-np.sin(2*tvalues) plt.plot(xvalues, yvalues, color='brown')plt.axhline(0, color='black', lw=1)plt.axvline(0, color='black', lw=1)plt.title('Cardioid')plt.savefig('cardioid.png')None
Read now
Unlock full access