如何解决无法更改MultiDiGraph中节点的颜色
无法更改MultiDiGraph中节点的颜色。你能帮我吗?
数据集: enter link description here
我的代码:
test_group=pd.Datarame('test_group.csv')
from pyvis import network as pvnet
def plot_g_pyviz(G,name='out.html',height='800px',width='800px'):
g = G.copy() # some attributes added to nodes
net = pvnet.Network(notebook=True,directed=True,height=height,width=width)
opts = '''
var options = {
"physics": {
"forceAtlas2Based": {
"gravitationalConstant": -100,"centralGravity": 0.1,"springLength": 100,"springConstant": 0.09,"avoidOverlap": 1
},"minVelocity": 0.4,"solver": "forceAtlas2Based","timestep": 0.10
}
}
'''
net.set_options(opts)
net.from_nx(g)
return net.show(name)
G_duration_v2 = nx.MultiDiGraph()
对于test_group.itertuples()中的行:
如果row [4] == 0:
G_duration_v2.add_edge(row[1],row[2],label=row[3],color='red',weight=10,width=row[5])
plot_g_pyviz(G_duration_v2)
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。