Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can one set the size of an igraph plot?

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))

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.

Here's how it looks right now: current plot

like image 834
Alex G. Avatar asked Jul 06 '14 15:07

Alex G.


1 Answers

From thie python igraph tutorial

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)
like image 77
Rachel Gallen Avatar answered Sep 20 '22 23:09

Rachel Gallen