Open Thomas-Ulrich opened 4 years ago
In commit 41f4d2b, I changed backend to widget and fix the interactive plots using this script:
find . -name "*.py" -exec sed -i 's/plt.gcf().canvas.draw()/plt.gcf().canvas.draw(); display(plt.gcf()); clear_output(wait=True)/g' {} \; find . -name "*.py" -exec sed -i 's/fig.canvas.draw()/fig.canvas.draw(); display(fig); clear_output(wait=True)/g' {} \; find . -name "*.py" -exec sed -i 's/fig2.canvas.draw()/fig2.canvas.draw(); display(fig2); clear_output(wait=True)/g' {} \; find . -name "*.py" -exec sed -i "/^[^#]/ s/plt.switch_backend(\"nbagg\")/%matplotlib widget\nfrom IPython.display import display, clear_output/g" {} \; find . -name "*.py" -exec sed -i "/^[^#]/ s/plt.switch_backend(\"TkAgg\")/%matplotlib widget\nfrom IPython.display import display, clear_output/g" {} \; find . -name "*.py" -exec sed -i 's/matplotlib.use(\"nbagg\")/%matplotlib widget\nfrom IPython.display import display, clear_output/g' {} \;
(some files need to be fixed manually, e.g. fd_ac2d_heterogeneous_solution.py)
I also removed plt.ion and ioff systematically with:
find . -name "*.py" -exec sed -i '/plt.ion()/d' {} \; find . -name "*.py" -exec sed -i '/plt.ioff()/d' {} \;
(avoiding Kernel does not exist warnings).
Kernel does not exist
CC @christadler
Let's wait for the semester to be finished to possibly merge this one (as I'm adding new changes every time I'm discovering new notebooks while teaching).
In commit 41f4d2b, I changed backend to widget and fix the interactive plots using this script:
(some files need to be fixed manually, e.g. fd_ac2d_heterogeneous_solution.py)
I also removed plt.ion and ioff systematically with:
(avoiding
Kernel does not exist
warnings).