我有一个时间序列中的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)
如何在一张照片中将它们按时间序列一起绘制?
答案 0 :(得分:0)
创建一个Plot
对象并逐个添加图形。 E.g:
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
命令在后台执行相同的操作:它创建一个图形,将绘制的对象添加到图形中,然后显示或保存它。