Dear hydrogen devs,
thank you for this awesome plugin. After a long journey from spyder over vim-ipython to the jupyter notebook with vim bindings, I found the perfect environment for me: atom + vim-mode + hydrogen.
Icing on the cake would be the opportunity to toggle inline plots. I find typing %matplotlib inline quite unusual in normal Python scripts and most of the time I want to use a mixture of both, i.e. inline mode to keep the overview and see if everything is working properly and interactive mode from time to time to inspect a figure and its data in more detail.
Any ideas on how to accomplish that?
We introduced the setting Startup Code precisely for this purpose. Something like this should work:
{"python2": "%matplotlib inline", "python3": "%matplotlib inline"}
Yes that helps to set up inline plots by default, but is there a way to toggle them, i.e. send something like plt.ion() per atom keybinding to the python kernel used by hydrogen? Thanks a lot.
As far a I know, Atom doesn't provide a macro recording feature.
Perhaps atom-macros may be of help. I will experiment with atom-macros when I find some time, and post back the results here.
I have a (quite strange 馃槈 ) solution to your problem.
You can create a separate python kernel which uses the inline option. To do this:
jupyter kernelspec listkernel.json file (if not run ipython kernel install)display_name in kernel.json to something else (e.g. Python 3 inline).{"Python 3 inline": "%matplotlib inline"} to yourstartup code`Now you can switch in the menu between the original and the "Python 3 inline" kernels.
@lgeiger The problem with switching kernels is that toggling the display mode would require to re-run all the previous code.
Yes thats true, but I think changing the matplotlib display mode requires a kernel restart anyway.
Where to put startup code?
@theotheo Edit > Preferences > Packages > Hydrogen > Settings > Startup Code
https://stackoverflow.com/questions/43545050/using-matplotlib-notebook-after-matplotlib-inline-in-jupyter-notebook-doesnt view this thread for solutions/discussion. But it doesn't seem like toggling backends multiple times is recommended.
Most helpful comment
@theotheo
Edit > Preferences > Packages > Hydrogen > Settings > Startup Code