代码之家  ›  专栏  ›  技术社区  ›  Makogan

VS代码渲染图中的Jupyter笔记本

  •  0
  • Makogan  · 技术社区  · 3 年前

    我想用VS代码中的Jupyter笔记本或浏览器来渲染一个图形,我正在尝试使用一个使用dash的示例(但我会接受任何可行的方法)。

    我举了一个例子: https://dash.plotly.com/cytoscape

    这似乎微不足道,并为Jupyter修改了它:

    from jupyter_plotly_dash import JupyterDash
    import dash
    from os import listdir
    from os.path import isfile, join
    import dash_cytoscape as cyto
    from dash import html
    import json
    onlyfiles = [f for f in listdir("../neverengine_personal/Source")]
    
    app = JupyterDash(__name__)
    
    app.layout = html.Div([
        cyto.Cytoscape(
            id='cytoscape-two-nodes',
            layout={'name': 'preset'},
            style={'width': '100%', 'height': '400px'},
            elements=[
                {'data': {'id': 'one', 'label': 'Node 1'}, 'position': {'x': 75, 'y': 75}},
                {'data': {'id': 'two', 'label': 'Node 2'}, 'position': {'x': 200, 'y': 200}},
                {'data': {'source': 'one', 'target': 'two'}}
            ]
        )
    ])
    
    app
    

    enter image description here

    我还尝试了firefox中的jupyter,这给了我一个错误:

    enter image description here 我不知道;不理解为什么VS代码窗口拒绝渲染;t投诉。变量报告了我的期望:

    enter image description here

    0 回复  |  直到 3 年前