On Mon, Sep 28, 2009 at 12:39 PM, Nicolas M. Thiery
<nicolas.thi...@u-psud.fr> wrote:
>        Hi Kjell,
>
> On Mon, Sep 28, 2009 at 08:15:56AM +0200, Kjell Magne Fauske wrote:
>> I'm sorry. I forgot that the dot2tex.log files is not generated when
>> dot2tex is used as a module. To get the log you can try this:
>>
>> import dot2tex
>> texcode = dot2tex.dot2tex(testgraph, debug=True)
>>
>> logstream = dot2tex.get_logstream()
>> print logstream.getvalue()
>
> A well deserved RTFM :-)
>
>> I have not tested you code properly yet. One thing I see from your
>> code is that you don't use the high level interface to dot2tex. I'm
>> not sure if that has anything to do with your problem, but the
>> recommended way to call dot2tex is using the interface described here:
>> http://www.fauskes.net/code/dot2tex/documentation/#using-dot2tex-as-a-module
>>
>> Using the high level interface ensures that the options are
>> initialized properly.
>
> Yeah, and it's much simpler :-)
>
> Please find the new code and the full log below, with both inputs. It
> seems to boil down to this:
>
> ------------------------------------------------------------------------------
> zephyr-/tmp>cat bla.dot
> digraph {
>    objects[fixedsize=true,height=0.262085102124,width=0.233819917125,label=" 
> ",texlbl="$1$"];
>    
> objects[fixedsize=true,width=0.233819917125,height=0.262085102124,texlbl="$1$",label="
>  "];
>    graph[d2toutputformat=tikz];
>
>    graph [d2toutputformat=tikz];
> }
> zephyr-/tmp>/usr/bin/dot -Txdot /tmp/bla.dot
> Warning: node 'objects', graph '_anonymous_0' size too small for label
> digraph {
>        node [label="\N"];
>        graph [d2toutputformat=tikz,
>                bb="0,0,16,20",
>                _draw_="c 5 -white C 5 -white P 4 0 0 0 20 16 20 16 0 ",
>                xdotversion="1.2"];
>        objects [label=" ", fixedsize=true, height="0.26", width="0.22", 
> texlbl="$1$", pos="8,10", _draw_="c 5 -black e 8 10 8 10 ", _ldraw_="F 
> 14.000000 11 -Times-Roman c 5 -black T 8 5 0 5 1 -  "];
> }
> ------------------------------------------------------------------------------
>
> Apparently, the warning makes dot2tex unhappy. Tracking this further
> down, around line 210 of dot2tex.py, in create_xdot, stderr is closed
> before the data is read from stdout. I haven't done IPC in a while,
> but this could be the issue; at least, swapping the two lines seemed
> to fix/workaround the problem (assuming of course that the warning can
> be safely ignored).
>

Thank you Nicolas for chasing down this bug. I have made the changes
you suggested:
http://code.google.com/p/dot2tex/source/detail?r=249
I have to test it some more, but could you try the latest version of
dot2tex.py from trunk to verify that it fixes your problem?
http://dot2tex.googlecode.com/svn-history/r249/trunk/dot2tex/dot2tex.py

> By the way, and purely out of curiosity, is there a reason for having
> the "objects" node repeated twice?
>

I will look into this, It is probably because of the way the graph is
represented internally. The parser and data structure is not very
elegant. A node can appear multiple times in a graph structure. So
instead of keeping track of where every node is in the structure I
just append a node statement at the end of the graph when I want to
modify attributes. Here is an example:

digraph a {
  subgraph {
    a -> b;
    a[label=hello];
  }
  b->d;
};

If I want to change the width of node a I do it like this:
digraph a {
  subgraph {
    a -> b;
    a[label=hello];
  }
  b->d;
  a [width=0.4, label=hello];
};

Not very elegant, but as long as it is valid DOT-code Graphviz is happy.

Regards,
Kjell Magne Fauske

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sage-combinat-devel" group.
To post to this group, send email to sage-combinat-devel@googlegroups.com
To unsubscribe from this group, send email to 
sage-combinat-devel+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-combinat-devel?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to