Graphviz:作成例

最終更新日時:2017-03-31 20:11:45
Graphviz

概要


Graphviz の dot ファイルの作成例です。
メモを兼ねてさらしておきます(/_\;)
一部うまく動かないものもあったり。。。(/_\;)

 digraph sample {
    graph [size = "1000,1000", fontname = "HONYA\-JI", label = "Graphviz サンプル", labelloc = t, labeljust = l, fontcolor="red" fontsize=20,
           bgcolor="#EEEEEE", rankdir= LR, concentrate = true, compound = true];
    node [ shape = house ];
    edge [color = "red"];
 
    subgraph cluster1 {
        label = "Cluster 1";
        color = "#999999";
        style = bold;
        record [shape = record, label = "1|<p_2> 2|3|4"];
        Mrecord [shape = Mrecord, label = "{1|2|<p_3> 3|4}"];
        record2 [shape = record, label = "{1|2|3}|4|5|{6|{<p_7> 7|8|{9|10|11}}}|12"];
        record:p_2 -> Mrecord:p_3;
    }
 
    subgraph nocluster1 {
        label = "No Cluster 1";
        house [shape = house];
        pentagon [shape = pentagon];
        house -> pentagon;
    }
 
    node1 [shape = box, style = "rounded,filled", color="#FF0000", fillcolor="#FF9999", label = "box\n四角", fontname = "kochi-gothic-subst",
           fixedsize=ture, width=2, height=1 ];
    polygon [shape = polygon, style = diagonals, label = "polygon\n多角形\l", fontname="HONYA\-JI", fontcolor="#FF0000", fontsize=10];
    ellipse [shape = ellipse, style = dashed, label = "ellipse\n楕円\r"];
    circle [shape = circle, peripheries = 2, label = "円"];
    point [shape = point];
    egg [shape = egg, style = solid, peripheries = 3];
    triangle [shape = triangle, style = bold];
    plaintext [shape = plaintext];
    diamond [shape = diamond, style = dotted];
    trapezium [shape = trapezium];
    parallelogram [shape = parallelogram];
    hexagon [shape = hexagon];
    septagon [shape = septagon];
    octagon [shape = octagon];
    doublecircle [shape = doublecircle];
    doubleoctagon [shape = doubleoctagon];
    tripleoctagon [shape = tripleoctagon];
    invtriangle [shape = invtriangle];
    invtrapezium [shape = invtrapezium];
    invhouse [shape = invhouse];
    Mdiamond [shape = Mdiamond];
    Msquare [shape = Msquare];
    Mcircle [shape = Mcircle];
    rect [shape = rect];
    rectangle [shape = rectangle];
    square [shape = square];
    none [shape = none];
    note [shape = note];
    tab [shape = tab];
    folder [shape = folder];
    box3d [shape = box3d];
    component [shape = component];
    invisible [style = invisible];
 
    node1 -> polygon [label = "lable1", labelfloat = true];
    polygon -> dummy [label = "label2", color="blue", style = dashed];
    node1 -> ellipse [headlabel = "label3 end", taillabel = "label3 start", labeldistance = 3, labelangle =30];
    ellipse -> dummy2 [arrowtail = odot, label="arrowtail = odot"] 
    dummy2 -> parallelogram -> hexagon;
    node1 -> circle [dir=back, label="back"];
    node1 -> point [dir=both, label="both"];
    node1 -> egg [dir=none, label="none"];
    node1 -> triangle[arrowhead = dot, label="arrowhead=dot"];
    node1 -> plaintext [arrowsize = 2];
    node1 -> diamond -> trapezium;
    node1 -> septagon;
    node1 -> octagon;
    node1 -> doublecircle;
    node1 -> doubleoctagon;
    node1 -> tripleoctagon;
    node1 -> invtriangle;
    node1 -> invtrapezium;
    node1 -> invhouse;
    node1 -> Mdiamond;
    node1 -> Msquare;
    node1 -> Mcircle;
    node1 -> rect;
    node1 -> rectangle;
    node1 -> square;
    node1 -> none;
    node1 -> note;
    node1 -> tab;
    node1 -> folder;
    node1 -> box3d;
    node1 -> component;
    node1 -> invisible;
 
    //box3d -> record [lhead=cluster1]; # なぜかエラーとなる
    component -> record;
    //record -> house [ltail=cluster1]; # なぜかエラーとなる
    record2:p_7 -> house;
 
    {rank = same; dummy; triangle}
    {rank = same; house; hexagon}
 }


実行結果


お問い合わせは 掲示板 にて。