Tree Graphviz中树形图的平行边
我一直在尝试制作一个树形图,在节点之间运行多组边。 目标是看起来像这样: 我可以用一组边制作一张图表,如下所示: 但是,我不知道如何添加第二组边,而不让边到处都是 当我尝试执行此操作时,我的输出如下所示: 我不知道该怎么做。我的假设是graphviz试图避免边缘重叠 因此,我的问题是: 如何在graphviz中显示三幅图像中的第一幅,而不是最后一幅 我用来生成图表的代码是:Tree Graphviz中树形图的平行边,tree,graphviz,vector-graphics,dot,Tree,Graphviz,Vector Graphics,Dot,我一直在尝试制作一个树形图,在节点之间运行多组边。 目标是看起来像这样: 我可以用一组边制作一张图表,如下所示: 但是,我不知道如何添加第二组边,而不让边到处都是 当我尝试执行此操作时,我的输出如下所示: 我不知道该怎么做。我的假设是graphviz试图避免边缘重叠 因此,我的问题是: 如何在graphviz中显示三幅图像中的第一幅,而不是最后一幅 我用来生成图表的代码是: graph test_chart{ splines=ortho rankdir=UD ratio="fill" gra
graph test_chart{
splines=ortho
rankdir=UD
ratio="fill"
graph[nodesep=1]
A[shape=box color=red, labe="A"group=1]
B[shape=box color=blue, label="B"]
C[shape=box color=blue, label="C" ]
D[shape=box color=blue label="D" ]
E[shape=box color=blue label="E"]
F[shape=box color=blue label="F"]
{p0, p1, p2, n0, n1, n2[shape=point label=""]}
p0[group=1]
edge[color="red"]
A-- p0
p1--B
p1--C
p2--D
p2--E
rank=same{p1--p0--p2}
{rank=same B--C--D--E[style=invis]}
edge[color=blue]
A-- n0
rank=same{n1--n0--n2}
n1--C
n1--D
n2--E
n2--F
}
是的,这是可以做到的,几乎没有,但我只能做很多的未来。但是我不得不去掉正交边,使用直线
graph test_chart {
graph [bb="0,0,578,147.6",
nodesep=1,
splines=line
];
node [label="\N",
shape=point
];
{
graph [rank=min];
node [label="",
shape=point
];
A [color=red,
height=0.5,
label=A,
pos="226,129.6",
shape=box,
width=0.75];
}
{
graph [rank=max];
node [shape=box];
B [color=blue,
height=0.5,
label=B,
pos="27,18",
shape=box,
width=0.75];
C [color=blue,
height=0.5,
label=C,
pos="153,18",
shape=box,
width=0.75];
D [color=blue,
height=0.5,
label=D,
pos="299,18",
shape=box,
width=0.75];
E [color=blue,
height=0.5,
label=E,
pos="425,18",
shape=box,
width=0.75];
F [color=blue,
height=0.5,
label=F,
pos="551,18",
shape=box,
width=0.75];
}
edge [color=red]
__Ab [height=0.05,
pos="221,73.8",
width=0.05];
__Bb [height=0.05,
pos="26,73.8",
width=0.05];
__Cb [height=0.05,
pos="143,73.8",
width=0.05];
__Db [height=0.05,
pos="289,73.8",
width=0.05];
__Eb [height=0.05,
pos="415,73.8",
width=0.05];
__Ab -- A
__Bb -- B
__Cb -- C
__Db -- D
__Eb -- E
__Bb -- __Eb
edge [color=blue]
__Ac [height=0.05,
pos="236,52",
width=0.05];
__Cc [height=0.05,
pos="163,52",
width=0.05];
__Dc [height=0.05,
pos="309,52",
width=0.05];
__Ec [height=0.05,
pos="435,52",
width=0.05];
__Fc [height=0.05,
pos="561,52",
width=0.05];
__Ac -- A
__Cc -- C
__Dc -- D
__Ec -- E
__Fc -- F
__Cc -- __Fc
}
是的,这是可以做到的,几乎没有,但我只能做很多的未来。但是我不得不去掉正交边,使用直线
graph test_chart {
graph [bb="0,0,578,147.6",
nodesep=1,
splines=line
];
node [label="\N",
shape=point
];
{
graph [rank=min];
node [label="",
shape=point
];
A [color=red,
height=0.5,
label=A,
pos="226,129.6",
shape=box,
width=0.75];
}
{
graph [rank=max];
node [shape=box];
B [color=blue,
height=0.5,
label=B,
pos="27,18",
shape=box,
width=0.75];
C [color=blue,
height=0.5,
label=C,
pos="153,18",
shape=box,
width=0.75];
D [color=blue,
height=0.5,
label=D,
pos="299,18",
shape=box,
width=0.75];
E [color=blue,
height=0.5,
label=E,
pos="425,18",
shape=box,
width=0.75];
F [color=blue,
height=0.5,
label=F,
pos="551,18",
shape=box,
width=0.75];
}
edge [color=red]
__Ab [height=0.05,
pos="221,73.8",
width=0.05];
__Bb [height=0.05,
pos="26,73.8",
width=0.05];
__Cb [height=0.05,
pos="143,73.8",
width=0.05];
__Db [height=0.05,
pos="289,73.8",
width=0.05];
__Eb [height=0.05,
pos="415,73.8",
width=0.05];
__Ab -- A
__Bb -- B
__Cb -- C
__Db -- D
__Eb -- E
__Bb -- __Eb
edge [color=blue]
__Ac [height=0.05,
pos="236,52",
width=0.05];
__Cc [height=0.05,
pos="163,52",
width=0.05];
__Dc [height=0.05,
pos="309,52",
width=0.05];
__Ec [height=0.05,
pos="435,52",
width=0.05];
__Fc [height=0.05,
pos="561,52",
width=0.05];
__Ac -- A
__Cc -- C
__Dc -- D
__Ec -- E
__Fc -- F
__Cc -- __Fc
}
这是PIC(dpic)中的一个未优化版本。宏会使它变小
.PS
move down;
right;
move right
B: box "B"; move right
C: box "C"; move right
D: box "D"; move right
E: box "E"; move right
F: box "F"; move right
b2cX=C.c.x-B.c.x
move to C.e + (D.w-C.e)/2; move up 1
A: box "A" outline "red"
a2redlineY=A.s.y - D.n.y
redDeltaYtop=a2redlineY * .5
redDeltaYbottom=a2redlineY-redDeltaYtop
blueDeltaYtop=a2redlineY * .75
blueDeltaYbottom=a2redlineY-blueDeltaYtop
down
############################################################
# RED
############################################################
# draw line down from A to the (to be drawn) bus
X: line down redDeltaYtop from .25 <A.sw,A.se> outline "red"
Ap: X.s
line left to ((B.w.x+((B.e.x-B.w.x)*.3)), Here.y) outline "red"
line down redDeltaYbottom outline "red" # down to B
move up redDeltaYbottom # back up
line right b2cX outline "red" # line to C
X: line down redDeltaYbottom outline "red" # line down
Cp: X.n
move up redDeltaYbottom # back up
line right b2cX outline "red" # line to D
X: line down redDeltaYbottom outline "red" # line down
Dp: X.n
move up redDeltaYbottom # back up
line right b2cX outline "red" # line to E
X: line down redDeltaYbottom outline "red" # line down
Ep: X.n
move up redDeltaYbottom # back up
### draw connection points
circle diam .05 shaded "black" with .c at Ap
circle diam .05 shaded "black" with .c at Cp
circle diam .05 shaded "black" with .c at Dp
############################################################
# blue
############################################################
# draw line down from A to the (to be drawn) bus
X: line down blueDeltaYtop from .75 <A.sw,A.se> outline "blue"
Ap: X.s
line left to ((C.e.x+((C.w.x-C.e.x)*.3)), Here.y) outline "blue"
line down blueDeltaYbottom outline "blue" # down to C
move up blueDeltaYbottom # back up
line right b2cX outline "blue" # line to D
X: line down blueDeltaYbottom outline "blue" # line down
Dp: X.n
move up blueDeltaYbottom # back up
line right b2cX outline "blue" # line to E
X: line down blueDeltaYbottom outline "blue" # line down
Ep: X.n
move up blueDeltaYbottom # back up
line right b2cX outline "blue" # line to F
X: line down blueDeltaYbottom outline "blue" # line down
Fp: X.n
move up blueDeltaYbottom # back up
### draw connection points
circle diam .05 shaded "black" with .c at Ap
circle diam .05 shaded "black" with .c at Dp
circle diam .05 shaded "black" with .c at Ep
.PE
.PS
下移;
正确的;
右移
B:方框“B”;右移
C:方框“C”;右移
D:方框“D”;右移
E:方框“E”;右移
F:框“F”;右移
b2cX=C.C.x-B.C.x
移至C.e+(D.w-C.e)/2;上移1
A:框“A”轮廓“红色”
a2redlineY=A.s.y-D.n.y
redDeltaYtop=a2redlineY*.5
redDeltaYbottom=a2redlineY redDeltaYtop
blueDeltaYtop=a2redlineY*.75
blueDeltaYbottom=a2redlineY blueDeltaYtop
向下
############################################################
#红色的
############################################################
#从A到(待绘制)总线绘制线
X:从0.25的红色轮廓线向下排列红色TayTop“红色”
美联社:X.s
左线至((B.w.x+((B.e.x-B.w.x)*.3)),此处为.y)轮廓线“红色”
向下红色线底部轮廓“红色”#向下至B
向上移动Reddeltaybooth#向后移动
右侧b2cX轮廓线“红色”#线至C
X:下线红色底部轮廓“红色”#下线
Cp:X.n
向上移动Reddeltaybooth#向后移动
右侧b2cX轮廓线“红色”#线至D
X:下线红色底部轮廓“红色”#下线
Dp:X.n
向上移动Reddeltaybooth#向后移动
右侧b2cX轮廓线“红色”#至E的线
X:下线红色底部轮廓“红色”#下线
Ep:X.n
向上移动Reddeltaybooth#向后移动
###绘制连接点
圆圈直径05,阴影为“黑色”,Ap处带有.c
圆形直径05,阴影为“黑色”,Cp处带有.c
圆形直径05阴影“黑色”,在Dp处带有.c
############################################################
#蓝色的
############################################################
#从A到(待绘制)总线绘制线
X:从.75轮廓线“蓝色”向下排列blueDeltaYtop
美联社:X.s
左线至((C.e.x+((C.w.x-C.e.x)*.3)),此处为.y)轮廓“蓝色”
沿蓝色三角形底部轮廓线“蓝色”#向下至C
向上移动blueDeltaYbottom#后退
右侧b2cX轮廓线“蓝色”#线至D
X:直线下降蓝色DeltayBottom轮廓“蓝色”#直线下降
Dp:X.n
向上移动blueDeltaYbottom#后退
右侧b2cX轮廓线“蓝色”#线至E
X:直线下降蓝色DeltayBottom轮廓“蓝色”#直线下降
Ep:X.n
向上移动blueDeltaYbottom#后退
右侧b2cX轮廓线“蓝色”#线至F
X:直线下降蓝色DeltayBottom轮廓“蓝色”#直线下降
Fp:X.n
向上移动blueDeltaYbottom#后退
###绘制连接点
圆圈直径05,阴影为“黑色”,Ap处带有.c
圆形直径05阴影“黑色”,在Dp处带有.c
圆直径05阴影“黑色”,Ep处带有.c
体育课
这是PIC(dpic)中的一个未优化版本。宏会使它变小
.PS
move down;
right;
move right
B: box "B"; move right
C: box "C"; move right
D: box "D"; move right
E: box "E"; move right
F: box "F"; move right
b2cX=C.c.x-B.c.x
move to C.e + (D.w-C.e)/2; move up 1
A: box "A" outline "red"
a2redlineY=A.s.y - D.n.y
redDeltaYtop=a2redlineY * .5
redDeltaYbottom=a2redlineY-redDeltaYtop
blueDeltaYtop=a2redlineY * .75
blueDeltaYbottom=a2redlineY-blueDeltaYtop
down
############################################################
# RED
############################################################
# draw line down from A to the (to be drawn) bus
X: line down redDeltaYtop from .25 <A.sw,A.se> outline "red"
Ap: X.s
line left to ((B.w.x+((B.e.x-B.w.x)*.3)), Here.y) outline "red"
line down redDeltaYbottom outline "red" # down to B
move up redDeltaYbottom # back up
line right b2cX outline "red" # line to C
X: line down redDeltaYbottom outline "red" # line down
Cp: X.n
move up redDeltaYbottom # back up
line right b2cX outline "red" # line to D
X: line down redDeltaYbottom outline "red" # line down
Dp: X.n
move up redDeltaYbottom # back up
line right b2cX outline "red" # line to E
X: line down redDeltaYbottom outline "red" # line down
Ep: X.n
move up redDeltaYbottom # back up
### draw connection points
circle diam .05 shaded "black" with .c at Ap
circle diam .05 shaded "black" with .c at Cp
circle diam .05 shaded "black" with .c at Dp
############################################################
# blue
############################################################
# draw line down from A to the (to be drawn) bus
X: line down blueDeltaYtop from .75 <A.sw,A.se> outline "blue"
Ap: X.s
line left to ((C.e.x+((C.w.x-C.e.x)*.3)), Here.y) outline "blue"
line down blueDeltaYbottom outline "blue" # down to C
move up blueDeltaYbottom # back up
line right b2cX outline "blue" # line to D
X: line down blueDeltaYbottom outline "blue" # line down
Dp: X.n
move up blueDeltaYbottom # back up
line right b2cX outline "blue" # line to E
X: line down blueDeltaYbottom outline "blue" # line down
Ep: X.n
move up blueDeltaYbottom # back up
line right b2cX outline "blue" # line to F
X: line down blueDeltaYbottom outline "blue" # line down
Fp: X.n
move up blueDeltaYbottom # back up
### draw connection points
circle diam .05 shaded "black" with .c at Ap
circle diam .05 shaded "black" with .c at Dp
circle diam .05 shaded "black" with .c at Ep
.PE
.PS
下移;
正确的;
右移
B:方框“B”;右移
C:方框“C”;右移
D:方框“D”;右移
E:方框“E”;右移
F:框“F”;右移
b2cX=C.C.x-B.C.x
移至C.e+(D.w-C.e)/2;上移1
A:框“A”轮廓“红色”
a2redlineY=A.s.y-D.n.y
redDeltaYtop=a2redlineY*.5
redDeltaYbottom=a2redlineY redDeltaYtop
blueDeltaYtop=a2redlineY*.75
blueDeltaYbottom=a2redlineY blueDeltaYtop
向下
############################################################
#红色的
############################################################
#从A到(待绘制)总线绘制线
X:从0.25的红色轮廓线向下排列红色TayTop“红色”
美联社:X.s
左线至((B.w.x+((B.e.x-B.w.x)*.3)),此处为.y)轮廓线“红色”
向下红色线底部轮廓“红色”#向下至B
向上移动Reddeltaybooth#向后移动
线