Widget to control multiple cells for Jupyter Dashb

2019-07-13 01:51发布

问题:

I'm trying to build a jupyter dashboard which is going to contains many plots and tables. Ideally, all the plots and table will change accordingly to the same widget value at the same time.

I can create a function that will handle the creation of all plot and tables and show them, but then I'll be limiting the layout which is what jupyter dashboard is great for.

def create_dashboard(x, y, z):
    # make first plot using x
    ...
    # make second plot using x, y
    ...
    # draw table from dataframe using x, y, z
    ...

interact(create_dashboard, x, y ,z)

This could work but it very limiting. Also, you'd need to generate all the time all plots and table (many many) even if you don't change the variable that will modify the output. Also, the all be shown sequentially in the ipython cell without the ability to move them around when creating the dashboard.

Is there any way to draw plot using x, plot using y and table using x, y, z in individual cells, and then create a widget that controls all the three cells? Something like

output[1]
# plot using x

output[2]
# plot using x, y

output[3]
# table from dataframe using x, y, z

output[4]
interact(x, y, z)
# show the widget only here

Hope this is clear. I'm happy to provide additional information if is not.

Thanks!

回答1:

I would give a try with Plotly for python https://plot.ly/python/create-online-dashboard/

Let us know how it goes!