Recall & Review
beginner
What does 'figure size' control in a matplotlib plot?
Figure size controls the width and height of the plot in inches. It determines how big the plot will appear on the screen or in a saved image.
Click to reveal answer
beginner
What is DPI in matplotlib and why is it important?
DPI stands for Dots Per Inch. It controls the resolution of the figure, meaning how many dots (pixels) are used per inch. Higher DPI means sharper images.
Click to reveal answer
beginner
How do you set the figure size to 8 inches wide and 6 inches tall in matplotlib?
Use plt.figure(figsize=(8, 6)) to set the figure size to 8 inches wide and 6 inches tall.
Click to reveal answer
intermediate
How does increasing DPI affect the saved image size and quality?
Increasing DPI increases the number of pixels per inch, making the image sharper and larger in pixel dimensions. The file size usually becomes bigger too.
Click to reveal answer
intermediate
What happens if you set a large figure size but low DPI?
The plot will be physically large but may look blurry or pixelated because the resolution (DPI) is low.
Click to reveal answer
In matplotlib, what does figsize=(10, 5) mean?
✗ Incorrect
figsize sets the width and height in inches, so (10, 5) means 10 inches wide and 5 inches tall.
What does a higher DPI value do to a matplotlib figure?
✗ Incorrect
Higher DPI means more dots per inch, so the figure is sharper and has higher resolution.
Which code sets a figure size of 6x4 inches with 150 DPI?
✗ Incorrect
The correct syntax is figsize=(width, height) in inches and dpi=resolution.
If you want a small image file but still clear, what should you do?
✗ Incorrect
Small figure size reduces pixel count, and high DPI keeps the image sharp.
What unit is used for figure size in matplotlib?
✗ Incorrect
Matplotlib uses inches for figure size.
Explain how figure size and DPI work together to affect the appearance and quality of a matplotlib plot.
Think about how size and resolution affect a photo's clarity.
You got /4 concepts.
Describe how you would create a matplotlib figure that is 10 inches wide, 5 inches tall, and has a resolution of 200 DPI.
Remember figsize is a tuple of inches, dpi is dots per inch.
You got /4 concepts.