Monday, 5 June 2023

Switching Matplotlib backends programmatically in Spyder

I am running pyhton inside Spyder. My code produces static figures and an animated figure. For each type of figures, I need to use a different backend. How can I switch between them programmatically inside the code? I am trying things like

import matplotlib.pyplot as plt
import matplotlib
plt.switch_backend('TkAgg')
#matplotlib.use('TkAgg')
#Draw Static Plots
plt.switch_backend('Qt5Agg')
#matplotlib.use('Qt5Agg')
#Draw Dynamic Plots

But I get different kinds of errors.



from Switching Matplotlib backends programmatically in Spyder

No comments:

Post a Comment