Bird
0
0

What will be the size of the figure in inches after running this code?

medium📝 Predict Output Q13 of 15
Matplotlib - Export and Publication Quality
What will be the size of the figure in inches after running this code?
import matplotlib.pyplot as plt
plt.figure(figsize=(6, 3))
plt.plot([1, 2, 3], [4, 5, 6])
plt.show()
A6 inches wide and 3 inches tall
B3 inches wide and 6 inches tall
CDefault size (usually 6.4 x 4.8 inches)
DCannot determine without dpi
Step-by-Step Solution
Solution:
  1. Step 1: Identify figsize parameter values

    The code sets figsize=(6, 3), which means width=6 inches and height=3 inches.
  2. Step 2: Understand effect on figure size

    This directly sets the figure size regardless of dpi, so the figure will be 6 inches wide and 3 inches tall.
  3. Final Answer:

    6 inches wide and 3 inches tall -> Option A
  4. Quick Check:

    figsize=(6, 3) means width=6, height=3 inches [OK]
Quick Trick: figsize=(width, height) sets exact figure size in inches [OK]
Common Mistakes:
  • Swapping width and height values
  • Thinking dpi affects figsize dimensions
  • Assuming default size if figsize is set

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Matplotlib Quizzes