如何设置igraph图的大小? [英] How can one set the size of an igraph plot?

查看:50
本文介绍了如何设置igraph图的大小?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在绘制这样的图形:

I'm currently plotting my graphs like this:

        ig.plot(graph, target=file, vertex_color=membership,
            vertex_label=[index for index, value in enumerate(graph.vs)],
            vertex_frame_width=0,
            palette=ig.ClusterColoringPalette(len(set(membership)) + 3))

该图将输出到一页上的PDF文件中.看起来不错,但是节点太拥挤了.有没有办法将节点拉开,以便我实际上可以看到所有边缘?我当时想增加地块的面积,但我不知道该怎么做.

The plot is output to a PDF file on a single page. It looks decent but the nodes are too crowded. Is there a way to pull the nodes apart so that I can actually see all the edges? I was thinking of increasing the size of the plot but I don't know how to do that.

这是现在的样子:

推荐答案

来自python python

From thie python igraph tutorial

布局对象还包含一些有用的方法来批量翻译,缩放或旋转坐标.但是,布局对象的主要用途是可以将它们与图形一起传递给plot()函数以获得2D绘图

Layout objects also contain some useful methods to translate, scale or rotate the coordinates in a batch. However, the primary utility of Layout objects is that you can pass them to the plot() function along with the graph to obtain a 2D drawing

visual_style["layout"] = layout
visual_style["bbox"] = (300, 300)
visual_style["margin"] = 10
plot(g, **visual_style)

这篇关于如何设置igraph图的大小?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆