使用@Zarko 提供的解决方案马尔可夫链箭头和标签堆叠在一起,我想知道一种方法来插入一个比其他节点处于较低级别的节点,如下图所示:
我已成功创建了带有箭头的 3 个顶部节点。挑战在于创建带有箭头的下部节点。以下是我的 MWE:
\documentclass[border=3.141592]{standalone}
\usepackage{tikz}
\usetikzlibrary{arrows.meta, automata,
bbox,
chains,
positioning,
quotes}
\begin{document}
\begin{tikzpicture}[auto=right,
bezier bounding box,
node distance = 22mm,
start chain = going right,
every edge/.style = {draw, -Stealth, semithick},
every state/.style = {draw, thick, on chain}
]
\begin{scope}[nodes=state]
\node (A) {$1$};
\node (B) {$2$};
\node (C) {$3$};
\coordinate (E);
\end{scope}
%
\path[bend left, swap]
(A) edge["$.25$"] (B)
(B) edge["$.125$"] (C);
\path[out=210]
(B) edge[in=-30, "$.25$"] (A);
\end{tikzpicture}
\end{document}
答案1
例如,您可以使用below=<distance> of <node>
语法将4
节点放在下面1
并通过以下方式向右移动xshift=
\documentclass[border=3.141592]{standalone}
\usepackage{tikz}
\usetikzlibrary{arrows.meta, automata,
bbox,
chains,
positioning,
quotes}
\begin{document}
\begin{tikzpicture}[auto=right,
bezier bounding box,
node distance = 22mm,
start chain = going right,
every edge/.style = {draw, -Stealth, semithick},
every state/.style = {draw, thick, on chain}
]
\begin{scope}[nodes=state]
\node (A) {$1$};
\node (B) {$2$};
\node (C) {$3$};
\node[below=40pt of A, xshift=45pt] (D) {$4$};
\end{scope}
%
\path[bend left, swap]
(A) edge["$.25$"] (B)
(B) edge["$.125$"] (C);
\path
(A) edge["$.125$", bend right] (D)
(B) edge["$.125$", bend left, swap] (D);
\path[out=210]
(B) edge[in=-30, "$.25$"] (A);
\end{tikzpicture}
\end{document}