16

次のモックアップをドットで実装したいと思います。

ドットで実装するモックアップ

これまでのところ、私はこれだけ持っています:

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"];
}

私はそれを次のようにコンパイルします:

ドット -Gsplines=none test.gv | neato -n -Gsplines=ortho -Tpng -otest.png

それは私に近づきますが、知りたいことがいくつかあります。

  1. Foo の右側だけでなく、左右にブロックを配置するにはどうすればよいですか? 私はまだそれを理解することができませんでした。

  2. エッジ ラベルを一貫してエッジの上または下に配置することは可能ですか?

  3. 右側のノードを左に、左側のノードを右に揃えるにはどうすればよいですか? 1つの可能性は、それらを同じ幅にすることです。これで問題ありません。

ありがとう!!

アップデート:

受け入れられた回答に基づいて、上記のように、ネイトにパイプされたドットを介して生成された、まさに必要なものである次のことを行っています。

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"];
}
4

1 に答える 1

26

これで始められますか?

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;
}

ここに画像の説明を入力してください

アラインメントを取得するための生意気な方法として、ノーブレークスペースを使用したことに注意してください(私はC-kSpaceSpacevimで実行し、16進00a0文字になりました)

ラベル定義内でHTMLを使用することもできるため、フォント、色を使用して「スペーサー」を作成できます:http ://www.graphviz.org/doc/info/shapes.html#html

HTMLノードを使用すると、ラベルの整列が簡単になると思います。

于 2011-10-27T22:26:44.063 に答える