Tag Archives: Jupyter Notebok

IPython Jupyter Notebook Trick – Auto Module Reload and Inline Chart Plotting

Two really handy IPython Jupyter Notebook Tricks – Auto Module Reload and Inline Chart Plotting.

Auto Module Reload

Say in our main script we import an external module (that we own). By deafult if we’ve edited that module, it is not automatically reloaded (and therefore won’t take effect in the main script). To enable rapid iteration, it would be very handy to add this IPython magic command at the top – so whenever we’ve updated our module, it’s auto-reloaded in our main script.

Inline Chart Plotting

Another very handy magic command is inline chart plotting (via matplotlib). By default if we do a plot in Jupyter Notebook, a new window will pop up with the chart. If we include the following IPython magic command at the top, our chart may get rendered directly inline within the Jupyter Notebook. (Note that qtconsole by default do the plot inline so we won’t need to worry about that there. Note also that Jupyter Console is text based only and a chart can only be plotted in a new window – i.e. no inline).

Happy rapid iteration!