我正在尝试绘制一个状态转换模型,但无法让边从节点下方穿过,而不是穿过节点并沿途穿过其他边。我尝试过输入/输出选项,但这是目前最好的。我还应该研究哪些其他选项?
\begin{tikzpicture}[->,>=stealth', shorten >=1pt, auto, node distance=5cm,
thick,main node/.style={circle,
fill=blue!20,draw,thick,align=center}]
\node[main node] (1) {$M$ \\ $P_{x_i, y_j}$};
\node[main node] (2) [below right of=1]{$I_{y}$ \\ $q_{x_i}$};
\node[main node] (3) [above right of=1]{$I_{x}$ \\ $q_{y_j}$};
\node[main node] (4) [left of=1]{\(B\)};
\node[main node] (5) [below right of=3]{\(E\)};
\path[]
(1) edge [loop left, thick] node {$1-2\delta-\tau$} (1)
edge [thick, bend right] node[above] {$\delta$} (2)
edge [thick, bend left] node[below] {$\delta$} (3)
edge [thick] node[above]{$\tau$} (5)
(2) edge [loop right, thick] node[right] {$\epsilon$} (2)
edge [thick, bend right] node[above, rotate=-45] {$1-\epsilon-\tau$} (1)
edge [thick] node[above, rotate=60] {$\tau$} (5)
(3) edge [loop right, thick] node[right] {$\epsilon$} (3)
edge [thick, bend left] node[below, rotate=45] {$1-\epsilon-\tau$} (1)
edge [thick] node[above, rotate=120] {$\tau$} (5)
(4) edge [thick, out=-90, in=-90] node[below] {$\tau$} (5);
\end{tikzpicture}
答案1
你可以使用looseness
参数或其他一些参数进行操作,具体解释如下pgfmanual 中的“70.3 曲线”部分
\documentclass[tikz,border=2mm]{standalone}
\usetikzlibrary{arrows}
\begin{document}
\begin{tikzpicture}[->,>=stealth', shorten >=1pt, auto, node distance=5cm,
thick,main node/.style={circle,
fill=blue!20,draw,thick,align=center}]
\node[main node] (1) {$M$ \\ $P_{x_i, y_j}$};
\node[main node] (2) [below right of=1]{$I_{y}$ \\ $q_{x_i}$};
\node[main node] (3) [above right of=1]{$I_{x}$ \\ $q_{y_j}$};
\node[main node] (4) [left of=1]{\(B\)};
\node[main node] (5) [below right of=3]{\(E\)};
\path[]
(1) edge [loop left, thick] node {$1-2\delta-\tau$} (1)
edge [thick, bend right] node[above] {$\delta$} (2)
edge [thick, bend left] node[below] {$\delta$} (3)
edge [thick] node[above]{$\tau$} (5)
(2) edge [loop right, thick] node[right] {$\epsilon$} (2)
edge [thick, bend right] node[above, rotate=-45] {$1-\epsilon-\tau$} (1)
edge [thick] node[above, rotate=60] {$\tau$} (5)
(3) edge [loop right, thick] node[right] {$\epsilon$} (3)
edge [thick, bend left] node[below, rotate=45] {$1-\epsilon-\tau$} (1)
edge [thick] node[above, rotate=120] {$\tau$} (5)
(4) edge [thick, out=-90, in=-90, looseness=1.5] node[below] {$\tau$} (5);
\end{tikzpicture}
\end{document}