Bird
0
0

Which matplotlib function helps to explicitly release memory used by a figure?

easy📝 Conceptual Q2 of 15
Matplotlib - Performance and Large Data
Which matplotlib function helps to explicitly release memory used by a figure?
Aplt.figure()
Bplt.show()
Cplt.draw()
Dplt.close()
Step-by-Step Solution
Solution:
  1. Step 1: Identify function to close figures

    plt.close() is used to close a figure and release its memory.
  2. Step 2: Differentiate from other functions

    plt.show() displays figures, plt.draw() updates them, plt.figure() creates new ones.
  3. Final Answer:

    plt.close() -> Option D
  4. Quick Check:

    Memory release = plt.close() [OK]
Quick Trick: Use plt.close() to free memory after plotting [OK]
Common Mistakes:
  • Confusing plt.show() with closing
  • Using plt.draw() to close
  • Not closing figures at all

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Matplotlib Quizzes