How do you add background grid lines to a Matplotlib plot?
-
A
plt.mesh(True)
-
B
plt.grid(True)
Correct answer
-
C
plt.lines(True)
-
D
plt.axis('grid')
Correct answer
B. plt.grid(True)
21 views
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
Doubts & discussion
Not sure why the answer is B? Ask here and get an explanation.
Ask a doubt about this MCQ