What function is used to save a plot as an image file in Matplotlib?
Correct answer
C. savefig()
14 views
C. savefig()
14 views
savefig() saves the current figure to a file, with the format taken from the extension: plt.savefig("chart.png", dpi=300). PNG, PDF, SVG and JPG are supported.
Call it before plt.show(), otherwise the saved image may be blank.
For more solved questions like this one, see Data Science MCQs on MCQsExam.com.
Not sure why the answer is C? Ask here and get an explanation.