Jupyter Notebook - Plotting

IPython kernel of Jupyter notebook is able to display plots of code in input cells. It works seamlessly with matplotlib library. The inline option with the %matplotlib magic function renders the plot out cell even if show() function of plot object is not called. The show() function causes the figure to be displayed below in[] cell without out[] with number.

Matplotlib Library

Now, add plt.show() at the end and run the cell again to see the difference.

Note that the %matplotlib notebook magic renders interactive plot.

Just below the figure, you can find a tool bar to switch views, pan, zoom and download options.

Matplotlib Library Toolbar

Importantly, if you modify the data underneath the plot, the display changes dynamically without drawing another plot.

In the above example, change the data sets of x and y in the cell below and plot the figure again, the figure above will get dynamically refreshed.

Modify Data Underneath