English 中文(简体)
Jupyter Notebook - Plotting
  • 时间:2024-11-03

Jupyter Notebook - Plotting


Previous Page Next Page  

IPython kernel of Jupyter notebook is able to display plots of code in input cells. It works seamlessly with matplotpb pbrary. The inpne option with the %matplotpb 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.

Matplotpb Library

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

Note that the %matplotpb notebook magic renders interactive plot.

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

Matplotpb 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 Advertisements