Recall & Review
beginner
What does setting a transparent background in a matplotlib plot do?
It makes the plot's background see-through, so whatever is behind the image can be seen through the empty parts.
Click to reveal answer
beginner
How do you save a matplotlib figure with a transparent background?
Use the savefig() function with the argument transparent=True, like plt.savefig('file.png', transparent=True).
Click to reveal answer
intermediate
Which file formats support transparent backgrounds when saving matplotlib figures?
Formats like PNG and SVG support transparency. Formats like JPEG do not support transparent backgrounds.
Click to reveal answer
beginner
What is the default background color of a matplotlib figure if transparency is not set?
The default background color is white (or the default rcParams facecolor).
Click to reveal answer
intermediate
Can you make only the axes background transparent but keep the figure background opaque in matplotlib?
Yes, by setting the axes patch alpha value or facecolor with transparency, while keeping the figure's facecolor opaque.
Click to reveal answer
Which argument makes a matplotlib figure background transparent when saving?
✗ Incorrect
The savefig() function uses transparent=True to make the background transparent.
Which file format does NOT support transparent backgrounds?
✗ Incorrect
JPEG does not support transparency, unlike PNG and SVG.
What is the default background color of a matplotlib figure?
✗ Incorrect
By default, matplotlib figures have a white background.
How can you make only the axes background transparent in matplotlib?
✗ Incorrect
You can set the axes patch facecolor with transparency to make only the axes background transparent.
Which matplotlib function is used to save a figure with transparency?
✗ Incorrect
plt.savefig() is used to save figures, and it supports the transparent argument.
Explain how to save a matplotlib plot with a transparent background and why you might want to do this.
Think about how transparent backgrounds help when placing images on different backgrounds.
You got /3 concepts.
Describe the difference between making the entire figure background transparent versus only the axes background transparent in matplotlib.
Consider the layers of a matplotlib plot: figure and axes.
You got /4 concepts.