簡體   English   中英

python graph-tool切掉邊緣

[英]python graph-tool cuts off edges

用於python的graph-tool割斷了我的邊緣,無論我砍了多少,我似乎都無法修復它...幫助! 更改輸出大小不會執行任何操作。

另外,我的邊緣文字看起來很粗糙。 有什么建議么?

graph_draw(g, vertex_shape = vs, vertex_text = vl, vertex_font_size = 18, edge_text = el, edge_font_size = 40, edge_text_distance = 0,
           edge_marker_size = 30, output_size = (400,400), vertex_size = 40, output = "output.png")

在此處輸入圖片說明

您將fit_view = False選項傳遞給graph_draw() ,它將不會嘗試縮放圖形以適合輸出大小。 然后,您可以通過更改節點的位置來選擇視圖,這樣它就不會排除圖形的任何部分:

g = random_graph(10, lambda: 10, self_loops=True, directed=False)
pos = sfdp_layout(g)
x, y = ungroup_vector_property(pos, [0, 1])
x.a = (x.a - x.a.min()) / (x.a.max() - x.a.min()) * 200 + 100
y.a = (y.a - y.a.min()) / (y.a.max() - y.a.min()) * 200 + 100
pos = group_vector_property([x, y])
graph_draw(g, pos, output_size=(400, 400), output="foo.png", fit_view=False)

在此處輸入圖片說明

您可以通過調整屬性text_distancetext_parallelfont_size來改善邊緣標簽。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM