我想在代码中连接块B和M而不用使连接线“切开”F。如何强制连接扩大连接线并避免F?
\documentclass[11pt]{standalone}
\usepackage{tikz}
\usetikzlibrary{calc,shapes.geometric,arrows,positioning,intersections}
\begin{document}
\begin{tikzpicture}[auto,node distance=1cm,thick,
main node/.style={black,draw,minimum width=1.5cm,minimum height=0.75cm}]%circle,draw,font=\sffamily\Large\bfseries}]
\node[main node] (L) {L};
\node[main node] (F) [left = of L ] {F};
\node[main node] (C) [below = of F ] {M};
\node[main node] (B) [right = of L ] {B};
\node[main node] (AP) [below = of B ] {AP};
\node[main node] (A) [below = of L ] {A};
\node[main node] (H) [right = of B ] {H};
\node[main node] (G) [right = of H] {G};
\node[main node] (BR) [below = of G] {BR};
\node[main node] (LR) [below = of BR] {LR};
\node[main node] (U) [below = of AP ] {U};
\node[main node] (P) [below = of U ] {P};
\path[every node/.style={font=\sffamily\small}]
(L) edge node [right] {} (B)
(L) edge node [right] {} (F)
(L) edge node [right] {} (C)
(F) edge node [right] {} (C)
(B.north) edge [out=90,in=90] node [right] {} (F.north)
(B.north) edge [out=90,in=180] node [right] {} (C.west)
(B) edge node [right] {} (AP)
(B) edge node [right] {} (A)
(AP.east) edge [out=0,in=270] node [left] {} (H.south)
(B) edge node [right] {} (H)
(H) edge node [right] {} (G)
(U.east) edge [out=0,in=270] node [left] {} (H.south)
(P.east) edge [out=0,in=270] node [left] {} (H.south)
(U) edge node [right] {} (P)
(BR.west) edge [out=180,in=270] node [right] {} (H.south)
(LR.west) edge [out=180,in=270] node [right] {} (H.south)
(BR.east) edge [out=0,in=0] node [right] {} (G.east)
(LR.east) edge [out=0,in=0] node [right] {} (G.east);
\end{tikzpicture}
\end{document}
这就是我现在要得到的
这就是我想要得到的
谢谢!
答案 0 :(得分:1)
在tikz中没有直接的方法可以做到这一点,但是可以通过添加中间节点来实现。 这是两种方法。
第一个(蓝色)使用主路径中的边。由于边缘只有一个分支,因此会在适当的位置创建坐标,并在另一个边缘重新使用。
第二种方法(红色)使用带有多个中间节点的常规tikz线。它更加灵活,并且根据需要可以有任意数量的中间节点。
应调整中间节点的位置以达到所需的效果。
diff = data['Name'].diff().ne(1).cumsum()
data[['width','height']] = data.groupby(diff)['width','height'].shift()
print (data)
Name width height breadth
0 1 NaN NaN 2
1 2 13.0 90.0 1
2 3 101.0 45.0 1
3 5 NaN NaN 1
4 6 11.0 34.0 2