Saving plots to a file

To save a figure, we put plt.savefig(outputpath) at the end of plotting commands. It can be used in place of plt.show(), to directly save the figure without displaying it.

If you want to save the figure as a file as well as display it on the notebook output, you can call both plt.savefig() and plt.show().

Reversing the order can result in the plot elements being cleaned up, leaving a blank canvas for the saved figure file.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.147.55.69