1. Home
  2. Data Science
  3. Matplotlib
  4. Which method is used to save a Matplotlib figure to a file?

Added 24 Feb 2024

Which method is used to save a Matplotlib figure to a file?

  1. save_fig()
  2. export_fig()
  3. savefig() Correct answer
  4. exportfig()

Correct answer

C. savefig()

16 views

MCQSEXAM

Explanation

savefig() saves a Matplotlib figure to a file. It can be called as plt.savefig("plot.png") or on a figure object as fig.savefig(...).

Useful options include dpi for resolution and bbox_inches="tight" to trim margins.

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