igraph-help
[Top][All Lists]
Advanced

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

Re: [igraph] Horizontal gap (hgap) not taken into account when creating


From: Antonin Lenfant
Subject: Re: [igraph] Horizontal gap (hgap) not taken into account when creating a Sugiyama layout with the Python binding
Date: Mon, 1 Apr 2013 12:46:10 -0700

Hello Tamás,

Thanks, indeed the layout just needed a translation to fit in the drawing, great!

I couldn't find what causes the issue and reproduce it on a smaller graph, I'm afraid...
I packed everything in a pickle dump, if you're willing to check my original graph (which isn't small, unfortunately it has around 8k nodes). Here is the dump.

Here is the code that I used with this file and which showed the issue :
import igraph
import pickle

(g,layout_node_layer) = pickle.load(open("graph_export.dat", mode="rb"))

layout = g.layout_sugiyama(layers=layout_node_layer, hgap=1) #Using a maxiter=10000 improved a bit the layout but not by much because of the artifacts
layout_bounding_box = layout.bounding_box()
layout.translate((-1*layout_bounding_box.left, -1*layout_bounding_box.top))
layout_bounding_box = layout.bounding_box()
print("Layout computed", layout_bounding_box)

igraph.plot(g, "test_graph.pdf", layout=layout, vertex_label=None, bbox=layout_bounding_box)
#igraph.write(g, "test_graph.dot", format="dot")
print("File created")

Thank you for all the help you gave me, and good luck if you try to solve this problem.
If you manage to, I'd be curious to know what is its cause though.

Best regards,
Antonin Lenfant


On Fri, Mar 29, 2013 at 2:05 PM, Tamás Nepusz <address@hidden> wrote:
> I had no success using the layout's bounding box as the value for my plot's bbox parameter, because I could only see a few nodes on the left edge of my rendered pdf or svg. I think this might be because my layout's bounding box has a negative first element? It was BoundingBox(-926.5, 1.0, 13.0, 5097.0).
Yes, that's the cause. Translate your layout first to ensure that the upper left corner is at (0,0). You can use layout.translate() for that.

> However, when plotting I see some strange artifacts that were not visible when exporting to dot format and using Graphviz's dot renderer (which is similar to Sugiyama) : I wouldn't really know how to explain it so here is a screenshot :
> http://i.imgur.com/hhZz5v7.png
Whoa, that's a weird one. Can you send me a graph on which I can reproduce the issue?

--
Tamas
_______________________________________________
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]