1. Home
  2. Data Science
  3. Matplotlib
  4. What function is used to save a plot as an image file in…

Added 24 Feb 2024

What function is used to save a plot as an image file in Matplotlib?

  1. save_plot()
  2. export_plot()
  3. savefig() Correct answer
  4. exportfig()

Correct answer

C. savefig()

14 views

MCQSEXAM

Explanation

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.

Doubts & discussion

Not sure why the answer is C? Ask here and get an explanation.

Ask a doubt about this MCQ

Shown after review. No links please.

More Matplotlib MCQs

Practise all Matplotlib MCQs

Similar MCQs