Sat*_*aba 3 python graph jupyter-notebook pyvis dataspell
遇到这样的错误:本地cdn资源在jupyter-notebook中使用时在chrome/safari上有问题。它在使用 pyvis 库时出现。
net = Network(notebook=True)
net.add_nodes(
[1, 2, 3, 4, 5], # node ids
label=['Node #1', 'Node #2', 'Node #3', 'Node #4', 'Node #5'], # node labels
# node titles (display on mouse hover)
title=['Main node', 'Just node', 'Just node', 'Just node', 'Node with self-loop'],
color=['#d47415', '#22b512', '#42adf5', '#4a21b0', '#e627a9'] # node colors (HEX)
)
net.add_edges([(1, 2), (1, 3), (2, 3), (2, 4), (3, 5), (5, 1)])
net.show('graph.html')
Run Code Online (Sandbox Code Playgroud)
我尝试将浏览器切换到 dataspell
小智 5
来自pyvis 文档:
\n\n在 Chrome 浏览器中使用笔记本时,要渲染图形,请将附加 kwarg \xe2\x80\x98cdn_resources\xe2\x80\x99 传递为 \xe2\x80\x98remote\xe2\x80\x99 或 \xe2\x80\x98inline\xe2\ x80\x99
\n
我做到了net = Network(notebook=True, cdn_resources=\'in_line\')
我的注释 - 你必须使用“in_line”而不是“inline”。来源:
\nassert cdn_resources in ["local", "in_line", "remote"], "cdn_resources not in [local, in_line, remote]."\nRun Code Online (Sandbox Code Playgroud)\n此外,pyvis输出渲染目前是 DataSpell 的开放功能请求。如果您有兴趣,请观看并投票此票: DS-3446
| 归档时间: |
|
| 查看次数: |
5365 次 |
| 最近记录: |