带dot/graphviz的方框图布局

带dot/graphviz的方框图布局,graphviz,dot,graph-layout,Graphviz,Dot,Graph Layout,我想用dot实现以下模型: 到目前为止,我得到了这么多: digraph G { graph [rankdir = LR, splines=ortho] unit [shape=box, width = 2, height = 10]; more_different_unit [shape=box, height=4]; other_unit [shape=box, height=4]; unit -> other_unit [label = "foo"];

我想用dot实现以下模型:

到目前为止,我得到了这么多:

digraph G {
graph [rankdir = LR, splines=ortho]

  unit [shape=box, width = 2, height = 10];

  more_different_unit [shape=box, height=4];
  other_unit [shape=box, height=4];


  unit -> other_unit [label = "foo"];
  unit -> other_unit [label = "bar"];
  unit -> other_unit [label = "bar"];
  unit -> other_unit [label = "bar"];
  unit -> other_unit [label = "bar"];
  unit -> other_unit [label = "bar"];
  unit -> more_different_unit [label = "bar"];
  unit -> more_different_unit [label = "bar"];
  unit -> more_different_unit [label = "bar"];
  unit -> more_different_unit [label = "bar"];
  unit -> more_different_unit [label = "bar"];
  unit -> more_different_unit [label = "bar"];
}
我是这样编译的:

dot-Gsplines=none test.gv | neato-n-Gsplines=ortho-Tpng-otest.png

这让我很接近,但有几件事我想知道

  • 我怎样才能在Foo的左边和右边找到街区,而不仅仅是右边?我还没弄明白

  • 是否可以将边缘标签始终放在边缘上方或下方

  • 如何将右侧节点向左对齐,将左侧节点向右对齐?一种可能是使它们具有相同的宽度,这是可以的

  • 谢谢

    更新:

    根据已接受的答案,我现在正在做以下工作,这正是我所需要的,同样是通过点输送到neato生成的,如上所述:

    digraph G {
        graph [rankdir = LR, splines=ortho];
    
        node[shape=record];
        Bar[label="Bar", height=2];
        Foo[label="Foo", height=4];
    
        Bew[label="Bew", height=2];
        Gate[label="Gate", height=2];
    
        Bar -> Foo [label="Bar2Foo"];
        Bar -> Foo [label="Bar2Foo"];
        Bar -> Foo [label="Bar2Foo"];
    
        Foo -> Bew [label="Foo2Bew"];
        Foo -> Bew [label="Foo2Bew"];
        Bew -> Foo [label="Bew2Foo"];
    
    
        Foo -> Gate [label="Foo2Gate"];
        Foo -> Gate [label="Foo2Gate"];
    }
    

    这能让你开始吗

    digraph G {
        graph [rankdir = LR];
    
        node[shape=record];
        Bar[label="{ \"Bar\"|{<p1>pin 1|<p2>     2|<p3>     3|<p4>     4|<p5>     5} }"];
        Foo[label="{ {<data0>data0|<data1>data1|<data2>data2|<data3>data3|<data4>data4}|\"Foo\" |{<out0>out0|<out1>out1|<out2>out2|<GND>gnd|<ex0>ex0|<hi>hi|<lo>lo} }"];
    
        Bew[label="{ {<clk>clk|<syn>syn|<mux0>mux0|<mux1>mux1|<signal>signal}|\"Bew\" |{<out0>out0|<out1>out1|<out2>out2} }"];
        Bar:p1 -> Foo:data0;
        Bar:p2 -> Foo:data1;
        Bar:p3 -> Foo:data2;
        Bar:p4 -> Foo:data3;
        Bar:p5 -> Foo:data4;
    
        Foo:out0 -> Bew:mux0;
        Foo:out1 -> Bew:mux1;
        Bew:clk -> Foo:ex0;
    
        Gate[label="{ {<a>a|<b>b}|OR|{<ab>a\|b} }"];
    
        Foo:hi -> Gate:a;
        Foo:lo -> Gate:b;
        Gate:ab -> Bew:signal;
    }
    
    有向图G{
    图[rankdir=LR];
    节点[形状=记录];
    Bar[label=“{\“Bar\”{pin 1 | 2 | 3 | 4 | 5}}];
    Foo[label=“{data0 | data1 | data2 | data3 | data4}”Foo\“{out0 | out1 | out2 | gnd | ex0 | hi | lo}”;
    Bew[label=“{clk | syn | mux0 | mux1 | signal}}”Bew\“{out0 | out1 | out2}}”;
    条形图:p1->Foo:data0;
    条:p2->Foo:data1;
    条形图:p3->Foo:data2;
    条形图:p4->Foo:data3;
    条:p5->Foo:data4;
    Foo:out0->Bew:mux0;
    Foo:out1->Bew:mux1;
    Bew:clk->Foo:ex0;
    Gate[label=“{{


    我想用HTML节点对齐标签会更容易。

    Hmm我会用它,谢谢!它确实比我需要的复杂得多,但可能是另一种选择。我想在Foo的右侧添加另一个单元没什么大不了的。没什么大不了的,为DemoReceive添加了更多的“IC”,因为它让我得到了我想要的,尽管我的最终结果是有点不同。我用代码更新了我的问题。谢谢!你知道有专门的软件来做这件事,而不是搜索电路"在Ubuntu软件中心产生了13个结果,其中大约有4个似乎适合这项工作。还有,在更通用的矢量绘图部门;如果你需要动态生成东西,考虑一下使用python和similarI,我必须动态生成,所以我只知道点。不过我会查看PySSVG,看看如果真是这样的话!谢谢!好的,我们很乐意处理可能出现的任何其他问题。如果我的信息最终能帮助您,我将非常感谢您的支持。我支持您的支持,因为PySSVG。我不认为我需要使用它,但这是一个很好的提示。另一个建议是Tikz,它看起来很强大。it报告警告:正交边当前不可用处理边缘标签。尝试使用xlabels,这是什么问题?谢谢!