Bird
0
0

Find the mistake in this code snippet for setting title font size:

medium📝 Debug Q7 of 15
Matplotlib - Export and Publication Quality
Find the mistake in this code snippet for setting title font size:
import matplotlib.pyplot as plt
plt.title('Revenue', font_size=22)
plt.show()
ANo mistake, code is correct
Bplt.title does not accept font size
Cfont_size should be fontsize
Dfontsize must be set via rcParams only
Step-by-Step Solution
Solution:
  1. Step 1: Verify parameter name for font size in plt.title

    The correct parameter is 'fontsize', not 'font_size'.
  2. Step 2: Understand matplotlib parameter naming

    Using 'font_size' will cause an error or be ignored.
  3. Final Answer:

    font_size should be fontsize -> Option C
  4. Quick Check:

    Parameter is 'fontsize' not 'font_size' [OK]
Quick Trick: Use 'fontsize' keyword, not 'font_size' [OK]
Common Mistakes:
  • Using underscore in fontsize parameter
  • Thinking rcParams is only way to set font size
  • Assuming plt.title ignores unknown parameters

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Matplotlib Quizzes