Which function is used to add grid lines to the plot?

21. Which function is used to add grid lines to the plot?

  1. gridlines()
  2. grids()
  3. grid()
  4. 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

Comments and Discussions!

Load comments ↻






Copyright © 2024 www.includehelp.com. All rights reserved.