简体   繁体   English

plotly-dash 是否适用于 VS 代码中的 ipynb 文件

[英]Does plotly-dash work on ipynb files in VS code

I am new dash and was wondering if there is a way to run dash on.ipynb files in vs-code.我是新的 dash,想知道是否有办法在 vs-code 中运行 dash on.ipynb 文件。 I found out that using JupyterDash you're able to run dash on Jupyter IDE (The web version).我发现使用JupyterDash您可以在 Jupyter IDE(web 版本)上运行 dash。 I was wondering if there is a way to extend this to.ipynb files in vs-code (I heavily use vs-code Jupyter instead of the web version).我想知道是否有办法在 vs-code 中将此扩展为 .ipynb 文件(我大量使用 vs-code Jupyter 而不是 web 版本)。 I tried making a radio button using this code within a cell in a.ipynb file in vs-code and it didn't work (Of course the same code did work in Jupyter web version).我尝试在 vs-code 的 a.ipynb 文件的单元格中使用此代码制作单选按钮,但它不起作用(当然,相同的代码在 Jupyter web 版本中确实有效)。 If there is way to run it in vscode, please do let me know.如果有办法在 vscode 中运行它,请告诉我。

 from jupyter_plotly_dash import JupyterDash 
 import dash 
 import dash_core_components as dcc 
 import dash_html_components as HTML 
 from dash.dependencies import Input,Output 

 app = JupyterDash('SimpleExample')

 app.layout = html.Div([
    dcc.RadioItems(
        id = 'dropdown-color',
        options = [{'label' : c, 'value' : c.lower()} for c in ['Red','Green','Blue']],
        value = 'red'
    )
])
app

Follow the latest jupyter dash documents.关注最新的 jupyter dash 文档。 Try this:尝试这个:

from jupyter_dash import JupyterDash
import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input, Output

app = JupyterDash('SimpleExample')

app.layout = html.Div([
    dcc.RadioItems(
        id = 'dropdown-color',
        options = [{'label' : c, 'value' : c.lower()} for c in ['Red','Green','Blue']],
        value = 'red'
    )
]) 
# Run app and display result inline in the notebook
app.run_server(mode='inline')

More about it here:更多关于它的信息:
https://medium.com/plotly/introducing-jupyterdash-811f1f57c02e https://medium.com/plotly/introducing-jupyterdash-811f1f57c02e

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM