graphviz - 减少集群内节点的距离(但保持它们对齐)

问题描述 投票:1回答:1

我目前有这个集群。

imag1.

描述如下::

    subgraph cluster_Step0 {
    compound=true;
    style=filled;
    color=blue;

    start_Step0[color=black, fontsize=8, width=0.3, style=filled, shape=point];
    ver_Step0[color=green, fontsize=10, width=4, height=1, style=filled, shape=rectangle];
    action_Step0[color=red, fontsize=10, width=4, height=1, style=filled, shape=rectangle];
    end_Step0[color=white, fontsize=8, width=0.3, style=filled, shape=point];

    // Align
    start_Step0, ver_Step0, action_Step0, end_Step0 [group = Step0]

    // Connection within the node

    start_Step0 -> ver_Step0;
    ver_Step0 -> action_Step0;
    action_Step0 -> end_Step0;

    // node label
    label = "Step0";

    // VERIFICATION in node
    ver_Step0[label="<>"]

    // ACTION in node
    action_Step0[label="PRECONDITION"]
    }

.我想把这个图做得更 "密集 "一些,就像这样:

Fig2

我试过用ranksep,但没有任何进展。有什么建议吗?

graph nodes graphviz edges
1个回答
1
投票

我添加了 graph [ranksep=.1] 它产生了这个。enter image description here 你是否添加了 排名 图层面的属性?

digraph {
  graph [ranksep=.1]
   subgraph cluster_Step0 {
    compound=true;
    style=filled;
    color=blue;

    start_Step0[color=black, fontsize=8, width=0.3, style=filled, shape=point];
    ver_Step0[color=green, fontsize=10, width=4, height=1, style=filled, shape=rectangle];
    action_Step0[color=red, fontsize=10, width=4, height=1, style=filled, shape=rectangle];
    end_Step0[color=white, fontsize=8, width=0.3, style=filled, shape=point];

    // Align
    start_Step0, ver_Step0, action_Step0, end_Step0 [group = Step0]

    // Connection within the node

    start_Step0 -> ver_Step0;
    ver_Step0 -> action_Step0 
    action_Step0 -> end_Step0;

    // node label
    label = "Step0";

    // VERIFICATION in node
    ver_Step0[label="<>"]

    // ACTION in node
    action_Step0[label="PRECONDITION"]
    }
}
© www.soinside.com 2019 - 2024. All rights reserved.