Bird
0
0

You wrote this code but the zoom and pan buttons do not appear in the plot window:

medium📝 Debug Q14 of 15
Matplotlib - Interactive Features
You wrote this code but the zoom and pan buttons do not appear in the plot window:
import matplotlib.pyplot as plt
plt.plot([1, 2, 3], [4, 5, 6])
plt.show(block=False)

What is the likely reason?
AYou forgot to call <code>plt.enable_toolbar()</code>
BUsing <code>block=False</code> can prevent the toolbar from showing properly
CZoom and pan buttons are not available for line plots
DYou need to call <code>plt.show()</code> twice
Step-by-Step Solution
Solution:
  1. Step 1: Understand block=False effect

    Using plt.show(block=False) can cause the plot window to not fully initialize, hiding toolbar buttons.
  2. Step 2: Check other options

    No plt.enable_toolbar() function exists; zoom and pan are available for line plots; calling plt.show() twice is unnecessary.
  3. Final Answer:

    Using block=False can prevent the toolbar from showing properly -> Option B
  4. Quick Check:

    block=False may hide toolbar [OK]
Quick Trick: Avoid block=False to ensure toolbar shows [OK]
Common Mistakes:
  • Assuming toolbar needs enabling function
  • Thinking zoom/pan unavailable for line plots
  • Calling plt.show() multiple times

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Matplotlib Quizzes