jupyter / dashboards_server

[RETIRED] Server that runs and renders Jupyter notebooks as interactive dashboards
Other
181 stars 48 forks source link

Output widget and interactive matplotlib #322

Open fhgd opened 7 years ago

fhgd commented 7 years ago

How to embed an interactive matplotlib figure into an Output widget?

%matplotlib notebook
import matplotlib.pylab as plt

from IPython.display import display
from ipywidgets import Output

out = Output()
with out:
    print('inside top')
    plt.ioff()
    fig, axs = plt.subplots()
    display(fig)
    print('inside bottom')
out.layout.border = '1.5px solid'
display(out)

I just get

grafik

When I use %matplotlib notebook then I get a static matplotlib-figure where I can't zoom:

grafik

I want to have both :-)

akhmerov commented 7 years ago

I'm not sure if it's possible without compromising security: matplotlib output allows for arbitrary communication with the kernel, and the dashboard server should allow only a safe subset of messages.

EDIT: however an output widget even with arbitrary js should be possible.