我无法使用pywis框架python修复Map

cigdeys3  于 2022-12-17  发布在  Python
关注(0)|答案(1)|浏览(154)

我请求帮助,我使用pyvis框架显示企业网络,网络是随机绘制的,我必须使用按钮才能正确显示,是否可以在python代码中修复按钮值,使显示为默认?

def openxslx (table_name, name_sheet = 'Sheet1'):
    x = pd.read_excel(f'{path_track}/{table_name}.xlsx', sheet_name= name_sheet)
    return x

def clear(hostname):
    hostname_re = re.sub("^\s+|\n|\r|\s+$", '', hostname)
    hostname_list = hostname_re.split(',')
    return hostname_list

oren = openxslx('XXXXX')
nx_graph = net.Network(width='75%', height= '700px', notebook = False, cdn_resources = 'local')

for i in range(oren.shape[0]):
    hostname_a = clear(oren['network_name(tchk_a)'][i]) 
    hostname_b = clear(oren['network_name(tchk_b)'][i])
    for hostname in hostname_a:
        for hostname1 in hostname_b:
            nx_graph.add_node(hostname, label=f'{hostname}', )
            nx_graph.add_node(hostname1, label=f'{hostname1}')
            nx_graph.add_edge(hostname, hostname1)



nx_graph.hrepulsion()
nx_graph.toggle_physics(False)
nx_graph.show_buttons(filter_=['layout'])
nx_graph.show('nx.html')
const options = {
  "layout": {
    "hierarchical": {
      "enabled": true,
      "levelSeparation": -85,
      "nodeSpacing": 225,
      "treeSpacing": 310,
      "direction": "DU",
      "sortMethod": "directed"
    }
  }
}

我试图在字符串nx_graph = net中写入参数。网络(宽度=“75%”,高度=“700px”,笔记本= False,cdn_resources =“本地”)返回错误

5ssjco0h

5ssjco0h1#

nx_graph.set_options(选项= r '{“布局”:{“分层”:{“启用”:true,“级别分隔”:-85,“节点间距”:225,“树间距”:310、“方向”:“DU”、“排序方法”:“定向”}}}“)

相关问题