如何将布局位置传递给可视化

如何将布局位置传递给可视化#

  1. 将x, y列添加到节点表中

  2. 添加url参数“play=0”以防止页面加载时运行聚类。

[1]:
import pandas as pd
import graphistry

# To specify Graphistry account & server, use:
# graphistry.register(api=3, username='...', password='...', protocol='https', server='hub.graphistry.com')
# For more options, see https://github.com/graphistry/pygraphistry#configure

1. 节点应具有“x”、“y”列

[2]:
edges = pd.DataFrame({'s': [0,1,2, 3], 'd': [1,2,3, 0]})
nodes = pd.DataFrame({'n': [0,1,2, 3], 'x': [0, 0, 1, 1], 'y': [0, 5, 5, 0]})

2. 绑定应包括“.settings(url_params={‘play’: 0})”

[3]:
graphistry\
    .settings(url_params={'play': 0})\
    .nodes(nodes).edges(edges)\
    .bind(source='s', destination='d', node='n')\
    .plot()
[3]:
[ ]: