Bird
0
0

What will be the resolution (dpi) of the saved image after running this code?

medium📝 Predict Output Q4 of 15
Matplotlib - Export and Publication Quality
What will be the resolution (dpi) of the saved image after running this code?
import matplotlib.pyplot as plt
plt.plot([1, 2, 3])
plt.savefig('image.png')
A150 dpi
B300 dpi
C100 dpi (default)
D72 dpi
Step-by-Step Solution
Solution:
  1. Step 1: Check if dpi is specified in plt.savefig()

    In the code, dpi is not specified, so default dpi is used.
  2. Step 2: Identify matplotlib's default dpi value

    Matplotlib's default dpi for saving images is 100 dpi.
  3. Final Answer:

    100 dpi (default) -> Option C
  4. Quick Check:

    Default dpi = 100 if not set [OK]
Quick Trick: Default dpi is 100 unless specified [OK]
Common Mistakes:
  • Assuming dpi is 300 by default
  • Confusing dpi with figure size
  • Thinking dpi is 72 by default

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Matplotlib Quizzes