[英]Vertical and horizontal headers with Graphviz
I need to create a vertical and horizontal header with Graphviz, but I do not know how to make the two subgraphs have different orientation. 我需要使用Graphviz创建垂直和水平标题,但是我不知道如何使两个子图具有不同的方向。 I have tried with rankdir but apparently it does not work with subgraphs.
我尝试了Rankdir,但显然它不适用于子图。 I have no idea how to proceed.
我不知道该如何进行。 I appreciate any help.
感谢您的帮助。
digraph Table{
node[shape=box style=filled fillcolor=olivedrab2]
//rankdir=TB
subgraph Rows{
rankdir=TB
A[label="A"]
B[label="B"]
C[label="C"]
D[label="D"]
E[label="E"]
F[label="F"]
A->B
B->A
B->C
C->B
C->D
D->C
D->E
E->D
E->F
F->E
{rank=same A B C D E F}
}
subgraph Column{
rankdir=LR
M[label="M"]
N[label="N"]
O[label="O"]
P[label="P"]
Q[label="Q"]
R[label="R"]
M->N
//N->M
N->O
//O->N
O->P
//P->O
P->Q
//Q->P
Q->R
//R->Q
{rank=same M N O P Q R}
}
}
You almost did everything right. 您几乎把所有事情都做对了。 Just remove the
{rank=same MNOPQR}
line. 只需删除
{rank=same MNOPQR}
行即可。
You are correct, rankdir works only for the whole graph, it won't work for subgraphs separately. 没错 , rankdir仅适用于整个图,而不适用于子图。 But you can control position of nodes using:
但是您可以使用以下方法控制节点的位置:
which forces all nodes mentioned in subgraph to be at the same level. 强制子图中提到的所有节点都处于同一级别。
=false
attribute of an edge =false
边的=false
属性 which allows you to connect two nodes but not affect their position by this connection. 这使您可以连接两个节点,但不影响此连接的位置。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.