Recall & Review
beginner
What is the purpose of grid lines in a matplotlib plot?
Grid lines help to visually align data points with the axis values, making it easier to read and interpret the plot.
Click to reveal answer
beginner
How do you enable grid lines on a matplotlib plot?
Use the
plt.grid(True) function to turn on grid lines on the current plot.Click to reveal answer
intermediate
Which parameter controls the line style of grid lines in matplotlib?
The
linestyle parameter controls the style of grid lines, such as solid ('-'), dashed ('--'), or dotted (':').Click to reveal answer
intermediate
How can you customize the color and width of grid lines in matplotlib?
Use the
color parameter to set the grid line color and linewidth to set the thickness, for example: plt.grid(color='red', linewidth=0.5).Click to reveal answer
intermediate
What does the
axis parameter do in the plt.grid() function?The
axis parameter specifies which axis to apply grid lines to: 'both' (default), 'x', or 'y'.Click to reveal answer
Which function enables grid lines in matplotlib?
✗ Incorrect
The correct function to enable grid lines is
plt.grid(True).How do you make grid lines dashed in matplotlib?
✗ Incorrect
Use the
linestyle='--' parameter inside plt.grid() to make dashed grid lines.To show grid lines only on the y-axis, which parameter should you use?
✗ Incorrect
Set
axis='y' in plt.grid() to show grid lines only on the y-axis.Which parameter changes the thickness of grid lines?
✗ Incorrect
The
linewidth parameter controls the thickness of grid lines.What is the default axis setting for grid lines in matplotlib?
✗ Incorrect
By default, grid lines are shown on both axes (
axis='both').Explain how to customize grid lines in a matplotlib plot including color, style, and width.
Think about the parameters inside plt.grid() that control appearance.
You got /4 concepts.
Describe how to enable grid lines only on the x-axis in matplotlib and why you might want to do this.
Consider how grid lines can help focus on one dimension.
You got /3 concepts.