[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [igraph] Drawing graph with readable labels

From: Tamás Nepusz
Subject: Re: [igraph] Drawing graph with readable labels
Date: Tue, 29 Apr 2014 00:36:04 +0200


You can play around with the vertex.label.dist and vertex.label.degree 
parameters in the plot() call to specify the positions and distances of the 
labels from the center of the node. Of course this is feasible only if you can 
afford doing it manually. I am not aware of any method that does this 
automatically, although one possibility could be as follows (but I haven’t 
tried it so it may or may not work in your case):

1) If you have a graph with n vertices and m edges, create a new graph with 2n 
vertices and n+m edges as follows. For each node, duplicate it into a “regular 
node” and a “label node”. Connect the regular nodes in exactly the same way as 
your original graph, and attach the “label node” to its corresponding “regular 
node” by a single edge.

2) Lay out the original graph using some layout.

3) Create a preliminary layout for the modified graph using the original graph 
layout and place every label node near its corresponding regular node plus some 
small noise.

4) Run the Fruchterman-Reingold layout on the modified graph and constrain the 
regular nodes to stay in place -- this can be done by setting the minx, maxx, 
miny and maxy parameters of the call to layout.fruchterman.reingold properly. 
For extra credit, use a weights vector that assigns a larger weight to edges 
connecting regular nodes with label nodes to ensure that the label nodes stay 
close to their nodes.

5) Compare the position of each label node with its corresponding regular node, 
calculate their angle and distance, and use these as the vertex.labe.dist and 
vertex.label.degree parameters in the final plot() call.


From: Jean-Baptiste Pressac address@hidden
Reply: Help for igraph users address@hidden
Date: 28 April 2014 at 14:49:52
To:address@hidden address@hidden
Subject:  [igraph] Drawing graph with readable labels

> Hello,
> Is there a way to draw graphs in order to avoid the overlay of node's
> labels (like in this graph
> , where some labels
> are quite unreadable) ?
> Thanks,
> --
> Jean-Baptiste Pressac
> Traitement et analyse de bases de données
> Centre de Recherche Bretonne et Celtique
> UMS 3554
> 20 rue Duquesne
> CS 93837
> 29238 Brest cedex 3
> tel : +33 (0)2 98 01 68 95
> fax : +33 (0)2 98 01 63 93
> _______________________________________________
> igraph-help mailing list
> address@hidden
> https://lists.nongnu.org/mailman/listinfo/igraph-help

reply via email to

[Prev in Thread] Current Thread [Next in Thread]