簡體   English   中英

如何按時間序列繪制圖

[英]How to plot graph in time series

我按時間順序列出了igraph實例。

[<igraph.Graph object at 0xbae0f2c>, <igraph.Graph object at 0xb67e12c>, <igraph.Graph       object at 0xb67e0ac>, <igraph.Graph object at 0xb67e02c>, <igraph.Graph object at 0xb67e1ac>, <igraph.Graph object at 0xb67e22c>, <igraph.Graph object at 0xb67e2ac>, <igraph.Graph object at 0xb67e32c>]

我可以使用:

import igraph as ig
for graph in dgs._visualize_raw:
    layout=graph.layout("kk")
    ig.plot(graph,layout=layout)

如何將它們按時間序列一起繪制在一張圖片中?

創建一個Plot對象,然后將圖形一個接一個地添加到其中。 例如:

graphs = [Graph.GRG(10, 0.4) for _ in xrange(5)]
figure = Plot(bbox=BoundingBox(0, 0, len(graphs)*200, 200))
for i, graph in enumerate(graphs):
    figure.add(graph, bbox=BoundingBox(i*200, 0, (i+1)*200, 200), margin=20)
figure.show()            # this will show the figure
figure.save("test.pdf")  # this will save the figure into a PDF file; JPG, PS and SVG are also supported

實際上, plot命令在后台執行相同的操作:創建圖形,將要繪制的對象添加到圖形,然后顯示或保存它。

暫無
暫無

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

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