Bird
0
0

What will be the font size of the x-axis label in this code?

medium📝 Predict Output Q13 of 15
Matplotlib - Export and Publication Quality
What will be the font size of the x-axis label in this code?
import matplotlib.pyplot as plt
plt.plot([1, 2, 3], [4, 5, 6])
plt.xlabel('X Axis', fontsize=16)
plt.show()
A16 points
BDefault font size (usually 10)
C12 points
DNo label will appear
Step-by-Step Solution
Solution:
  1. Step 1: Identify the font size parameter in xlabel

    The code uses fontsize=16 in plt.xlabel, which sets the label font size to 16 points.
  2. Step 2: Understand matplotlib default behavior

    Since fontsize is explicitly set, it overrides the default size (usually 10).
  3. Final Answer:

    16 points -> Option A
  4. Quick Check:

    Explicit fontsize=16 sets label size = A [OK]
Quick Trick: Check fontsize parameter value to find label size [OK]
Common Mistakes:
  • Assuming default size when fontsize is set
  • Confusing label font size with tick font size
  • Thinking label won't show without extra commands

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Matplotlib Quizzes