What is the purpose of the plt.grid() function in Matplotlib?
Correct answer
A. To set gridlines on a plot
13 views
A. To set gridlines on a plot
13 views
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.
Not sure why the answer is A? Ask here and get an explanation.