2011-12-07 4 views
0

상단에 평행선 두 개를 그립니다. 그것을하는 방법? 내 코드가 여기에 있습니다. 출력 선의 높이가 같기 때문에 출력 선이 작동하지 않습니다.두 개의 평행선을 만드는 방법은 무엇입니까?

digraph G { 

    graph [center, rankdir=TB, bgcolor=black]; 
    edge [arrowsize=1, color=red, dir=none]; 

    node [penwidth=1, color=white, fontcolor=white, labelloc=b]; 

    BB1P1[shape=point, color=red, width=0.01]; 
    BB1P[shape=point, color=white, width=0.1]; 
    BB1PV[shape=point, color=red, width=0.01]; 
    BB1P2[shape=point, color=red, width=0.01]; 

    BB1P1 -> BB1P -> BB1PV -> BB1P2; 

    BB2P1[shape=point, color=red, width=0.01]; 
    BB2PV[shape=point, color=red, width=0.01]; 
    BB2P[shape=point, color=white, width=0.1]; 
    BB2P2[shape=point, color=red, width=0.01]; 

    BB2P1 -> BB2PV -> BB2P -> BB2P2; 

    { rank=same; BB1P1; BB1P; BB1PV; BB1P2 }; 
    { rank=same; BB2P1; BB2PV; BB2P; BB2P2 }; 

} 
+0

내가 두 눈에 보이지 않는 모서리를 추가하고이 작업을 수행합니다. BB1P1 -> BB2P1 [스타일 = invis]; BB1P2 -> BB2P2 [스타일 = invis]; – allenchen

답변

2

사실 하나 개 보이지 않는 노드는 충분하다 : 단지 변경

digraph G { 
    graph [center, rankdir=TB, bgcolor=black]; 
    edge [arrowsize=1, color=red, dir=none]; 

    node [penwidth=1, color=red, fontcolor=white, labelloc=b, shape=point, width=0.01]; 

    { 
     rank=same; 
     BB1P1; 
     BB1P[color=white, width=0.1]; 
     BB1PV; 
     BB1P2; 
    } 

    { 
     rank=same; 
     BB2P1; 
     BB2PV; 
     BB2P[color=white, width=0.1]; 
     BB2P2; 
    } 

    BB1P1 -> BB1P -> BB1PV -> BB1P2; 
    BB2P1 -> BB2PV -> BB2P -> BB2P2; 
    BB1P1 -> BB2P1[style=invis]; 
} 

또는 더 간단, rankdirLR에 :

digraph G { 
    graph [center, rankdir=LR, bgcolor=black]; 
    edge [arrowsize=1, color=red, dir=none]; 

    node [penwidth=1, color=red, fontcolor=white, labelloc=b, shape=point, width=0.01]; 

    BB1P[color=white, width=0.1]; 
    BB2P[color=white, width=0.1]; 

    BB1P1 -> BB1P -> BB1PV -> BB1P2; 
    BB2P1 -> BB2PV -> BB2P -> BB2P2; 
} 
+0

그게 좋습니다! 고맙습니다. – allenchen

관련 문제