Bird
0
0

What will be the shape of axes after running fig, axes = plt.subplots(3, 1)?

medium📝 Predict Output Q5 of 15
Matplotlib - Image Display
What will be the shape of axes after running fig, axes = plt.subplots(3, 1)?
AA single axes object
BA 1D numpy array with 3 axes objects
CA list of 3 axes objects
DA 2D numpy array with shape (3,1)
Step-by-Step Solution
Solution:
  1. Step 1: Understand axes shape for 3 rows, 1 column

    Axes is returned as a 1D numpy array with length equal to rows when columns=1.
  2. Step 2: Confirm shape

    So axes is a 1D array with 3 axes objects.
  3. Final Answer:

    A 1D numpy array with 3 axes objects -> Option B
  4. Quick Check:

    Single column subplot = 1D axes array [OK]
Quick Trick: Single column or row returns 1D axes array [OK]
Common Mistakes:
  • Expecting 2D array even with one column
  • Thinking axes is a list instead of numpy array
  • Confusing single axes object with array

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Matplotlib Quizzes