Bird
0
0

Which of the following is the correct syntax to create a matplotlib figure with width 6 inches and height 3 inches?

easy📝 Syntax Q3 of 15
Matplotlib - Export and Publication Quality
Which of the following is the correct syntax to create a matplotlib figure with width 6 inches and height 3 inches?
Aplt.figure(figsize=(6, 3))
Bplt.figure(size=(6, 3))
Cplt.figure(size=[6, 3])
Dplt.figure(figsize=[3, 6])
Step-by-Step Solution
Solution:
  1. Step 1: Recall correct parameter name

    The parameter to set figure size is 'figsize' and it takes a tuple.
  2. Step 2: Check tuple format and order

    Width is first, height second, so (6, 3) is correct.
  3. Final Answer:

    plt.figure(figsize=(6, 3)) -> Option A
  4. Quick Check:

    Correct figsize syntax = plt.figure(figsize=(width, height)) [OK]
Quick Trick: Use figsize=(width, height) tuple in plt.figure() [OK]
Common Mistakes:
  • Using 'size' instead of 'figsize'
  • Using list instead of tuple
  • Swapping width and height

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Matplotlib Quizzes