reddit / emacs

Python matplotlib interactive mode on by default

wehrad · 2022-05-28 17:53
Hi everyone, currently, I run `plt.ion()` (with plt as `import matplotlib.pyplot as plt`) anytime I want an interactive `matplotlib` plot. Which is quite inefficient. I would therefore like to set the `matplotlib` interactive mode on by default for any python code I run, without having to specify it... But couldn't find the solution so far...! I set my ipython in emacs with: `;; (setq python-shell-interpreter "ipython3" python-shell-interpreter-args "-i --simple-prompt")` Thank you a lot in advance for your help!
Gus_Gustavsohn · 2022-05-28 18:34
This can be done by just configuring a startup script on ipython.
wehrad · 2022-05-28 20:43
Thank you. I thought this could also be done in my emacs config but at the end I indeed went for a `plt.ion()` that I added in my `~/.ipython/profile_default/startup.py` Thanks!
Gus_Gustavsohn · 2022-05-28 23:56
Glad I could help. There might be a way to do it from emacs (as emacs is almighty!) but I wouldn't know that, as I'm kind of a noob myself.
simbledress · 2022-06-04 09:44
You can also use `inferior-python-mode-hook`.