Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

pop-up plots using Python Jupyter Notebook

Is there a way to have the plots created inside Jupyter Notebook using matplotlib to appear on a separate pop-up screen that would allow you to expand/shrink the image by hand? I've tried experimenting with (%matplotlib notebook) but that didn't really do the trick.

Just wondering if this is possible.

like image 833
Vikram Josyula Avatar asked Dec 08 '16 18:12

Vikram Josyula


People also ask

How do you display plots in Jupyter notebook?

Usually, displaying plots involves using the show() function from PyPlot. With Jupyter notebooks, this isn't necessary as the plots are displayed after running the cells containing the code that generates them. These plots are by default, displayed inline, which means, they're displayed in the notebook itself.

Which is used to display plots on the Jupyter notebook?

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.

Can you use matplotlib in Jupyter notebook?

Matplotlib is a Python library that is used often with Jupyter Notebook.


1 Answers

Just use an interactive backend. This works for me:

import matplotlib.pyplot as plt
%matplotlib tk
plt.plot([1, 2])

The notebook (nbagg) backend also allows for expand/shrink by hand. It has some rough edges though.

like image 126
Stop harming Monica Avatar answered Sep 21 '22 12:09

Stop harming Monica