如何相对于装饰路径放置节点?

如何相对于装饰路径放置节点?

我想将一个节点放置在由一系列箭头组成的decoration路径下方(即类似“ ”的位置):myDecoratePath.south在此处输入图片描述

为了获得这样的东西:

在此处输入图片描述

有没有办法用以下最小非工作示例来实现它(灵感来自pschulz 的回答)?

\documentclass[tikz,drop]{standalone}
\usepackage{tikz}
\usetikzlibrary{decorations.markings}

\tikzset{arrow/.pic={
    \draw[-latex,line width=1pt] (0,0) -- (0.1,0);%
}}%

\begin{document}
\begin{tikzpicture}[decoration = {%
            markings,%
            mark =%
                between positions 0 and 1 step 5mm % adjust step size here
                with {%
                     {\pic {arrow};},
                      postaction={decorate}}%
            }%
        ]%
        \path[decorate] (0, 0) -- (2, 0);%
        % Here the node I would like to place at something like 'myDecoratePath.south'
        % \node (n1)  [draw, text width=3em, minimum height=2em]   {node 1};%
\end{tikzpicture}
\end{document}

答案1

只需将节点放在正确位置即可里面你的路径并调整定位。

相对于路径的节点

\documentclass[tikz,drop,border=3.14mm]{standalone}
\usepackage{tikz}
\usetikzlibrary{decorations.markings, positioning}

\tikzset{arrow/.pic={
    \draw[-latex,line width=1pt] (0,0) -- (0.1,0);%
}}%

\begin{document}
\begin{tikzpicture}[decoration = {%
            markings,%
            mark =%
                between positions 0 and 1 step 5mm % adjust step size here
                with {%
                     {\pic {arrow};},
                      postaction={decorate}}%
            }%
        ]%
        \path[decorate] (0, 0) -- (2, 0) node (n1)  [pos=0.5, below = 4 pt , draw, text width=3em, minimum height=2em]   {node 1};%
\end{tikzpicture}
\end{document}

相关内容