Recall & Review
beginner
What is the purpose of using subplots in matplotlib?
Subplots allow you to display multiple plots or images in a single figure arranged in a grid layout. This helps compare or visualize several datasets side by side.
Click to reveal answer
beginner
How do you create a 2x2 grid of subplots in matplotlib?
Use plt.subplots(2, 2) to create a figure with 4 subplots arranged in 2 rows and 2 columns.
Click to reveal answer
beginner
Which matplotlib function is used to display an image in a subplot?
The function imshow() is used to display an image inside a subplot.Click to reveal answer
intermediate
How can you remove axis ticks and labels from a subplot image?
Call ax.axis('off') on the subplot axis object to hide axis ticks and labels for a cleaner image display.
Click to reveal answer
intermediate
Why is it useful to use tight_layout() when showing multiple images in subplots?
tight_layout() automatically adjusts spacing between subplots to prevent overlapping titles, labels, or images, making the figure look neat.
Click to reveal answer
Which function creates a grid of subplots in matplotlib?
✗ Incorrect
plt.subplots() creates a figure and a grid of subplots.
How do you display an image in a subplot axis named ax?
✗ Incorrect
ax.imshow(image) displays the image inside the specific subplot axis.
What does ax.axis('off') do in a subplot?
✗ Incorrect
ax.axis('off') hides the axis ticks and labels for a cleaner image display.
What is the effect of plt.tight_layout()?
✗ Incorrect
plt.tight_layout() adjusts spacing to prevent overlap between subplots.
If you want a 3x1 grid of images, which command is correct?
✗ Incorrect
plt.subplots(3, 1) creates 3 rows and 1 column of subplots.
Explain how to display multiple images in a grid using matplotlib subplots.
Think about creating the grid, showing images, cleaning axes, and adjusting layout.
You got /4 concepts.
Describe why and how you would remove axis ticks and labels when showing images in subplots.
Focus on visual clarity and how to achieve it.
You got /3 concepts.