Bird
0
0

You want to create a figure for a journal that requires a width of 3.5 inches and height of 2 inches. Which code correctly sets this size and saves the figure as a PNG file?

hard📝 Application Q8 of 15
Matplotlib - Export and Publication Quality
You want to create a figure for a journal that requires a width of 3.5 inches and height of 2 inches. Which code correctly sets this size and saves the figure as a PNG file?
Aplt.figure(figsize=[3.5, 2]) plt.save('plot.png')
Bplt.figure(size=(3.5, 2)) plt.savefig('plot.png')
Cplt.figure(figsize=(3.5, 2)) plt.savefig('plot.png')
Dplt.figure(figsize=(2, 3.5)) plt.savefig('plot.png')
Step-by-Step Solution
Solution:
  1. Step 1: Use correct figsize syntax

    figsize must be set with a tuple (3.5, 2).
  2. Step 2: Use correct save function

    plt.savefig() is the correct function to save figures.
  3. Final Answer:

    plt.figure(figsize=(3.5, 2)) plt.savefig('plot.png') -> Option C
  4. Quick Check:

    Correct figsize and save function used [OK]
Quick Trick: Use plt.savefig() to save figure after setting figsize [OK]
Common Mistakes:
  • Using 'size' instead of 'figsize'
  • Using plt.save instead of plt.savefig

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Matplotlib Quizzes