Home »
Python »
Matplotlib MCQs
Which function is used to add grid lines to the plot?
21. Which function is used to add grid lines to the plot?
- gridlines()
- grids()
- grid()
- gridmarks()
Answer: C) grid()
Explanation:
The grid() function is used to add grid lines to the plot. The syntax of the gird() function is –
# import statement
import matplotlib.pyplot as plt
...
...
plt.plot(x, y) # Draw plot
plt.grid() # Add grids
plt.show() # Show plot with grids