1. Home
  2. Data Science
  3. Matplotlib
  4. What is the purpose of the plt.grid() function in…

Added 24 Feb 2024

What is the purpose of the plt.grid() function in Matplotlib?

  1. To set gridlines on a plot Correct answer
  2. To create a grid of subplots
  3. To adjust the plot margins
  4. To display the plot

Correct answer

A. To set gridlines on a plot

13 views

MCQSEXAM

Explanation

plt.grid() adds gridlines to a plot, making values easier to read. Its appearance can be customised: plt.grid(True, linestyle="--", alpha=0.5).

A grid of subplots is created with plt.subplots(), a different function.

For more solved questions like this one, see Data Science MCQs on MCQsExam.com.

Doubts & discussion

Not sure why the answer is A? 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