1. Home
  2. Data Science
  3. Matplotlib
  4. How do you add background grid lines to a Matplotlib plot?

Added 2 Nov 2026

How do you add background grid lines to a Matplotlib plot?

  1. plt.mesh(True)
  2. plt.grid(True) Correct answer
  3. plt.lines(True)
  4. plt.axis('grid')

Correct answer

B. plt.grid(True)

21 views

MCQSEXAM

Explanation

plt.grid(True) adds grid lines. Options such as linestyle='--' and alpha=0.5 keep them subtle so they do not distract from the data.

Reference

Asked in: Data Science Interviews

Preparing for an exam?

Doubts & discussion

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