在 tikz 中定位箭头

在 tikz 中定位箭头

我该如何以这种方式放置这个箭头:

在此处输入图片描述

\tikzstyle{inpro}=[circle, thick, draw=yellow!50, fill=yellow!20, minimum size=3mm]
\tikzstyle{mater} = [rectangle, thick, draw=green!50, fill=green!20, minimum width=2.25cm, minimum height=.5cm, text centered]
\tikzstyle{react} = [rectangle, thick, draw=cyan!50, fill=cyan!20, minimum width=2cm, minimum height=2cm, text centered, text width=2cm]


\begin{tikzpicture}[node distance=2.5cm]
node font=\tiny;
\node(mater)[mater]{bubble};
\node(inpro1)[inpro, below=1cm of mater]{bubble};
\node(inpro2)[inpro, right of=inpro1]{bubble};
\node(dummy)[below=1cm of inpro1, yshift=2cm]{};
\node(dummy2)[below of=dummy, yshift=1cm]{};
\node(mater2)[mater, below of=dummy]{bubble};
\node(react1)[react, below right=1cm and 3cm of mater]{bubble};


\draw[->, ultra thick, draw=orange!50](mater)--(inpro1);
\draw[->, ultra thick, draw=orange!50](inpro1)--(inpro2);
\draw[->, ultra thick, draw=orange!50](inpro2)--(react1);
\draw[->, ultra thick, draw=orange!50, dashed](mater2)--(dummy2)|-(react1);



\end{tikzpicture}
\caption{The Proposed Process}
\end{figure}

\end{tikzpicture}

答案1

您正在使用/混合定位语法:它应该像below = of一致(而不是below of =)。此外,最好使用tikzset超过tikzstyle

使用您的代码:

\documentclass[tikz]{standalone}
\usetikzlibrary{positioning}

\tikzstyle{inpro}=[circle, thick, draw=yellow!50, fill=yellow!20, minimum size=3mm]
\tikzstyle{mater} = [rectangle, thick, draw=green!50, fill=green!20, minimum width=2.25cm, minimum height=.5cm, text centered]
\tikzstyle{react} = [rectangle, thick, draw=cyan!50, fill=cyan!20, minimum width=2cm, minimum height=2cm, text centered, text width=2cm]

\begin{document}
\begin{tikzpicture}[node distance=2.5cm]
node font=\tiny;
\node(mater)[mater]{bubble1};
\node(inpro1)[inpro, below=1cm of mater]{bubble2};
\node(inpro2)[inpro, right = of inpro1]{bubble3};
\node(dummy)[below=1cm of inpro1, yshift=2cm]{};
\node(dummy2)[below = of dummy, yshift=1cm]{};
\node(mater2)[mater, below = of dummy]{bubble4};
\node(react1)[react, below right=1.2cm and 4cm of mater]{bubble5};


\draw[->, ultra thick, draw=orange!50](mater)--(inpro1);
\draw[->, ultra thick, draw=orange!50](inpro1)--(inpro2);
\draw[->, ultra thick, draw=orange!50](inpro2)--(react1.west|-inpro2);  %%% here
\draw[->, ultra thick, draw=orange!50, dashed](mater2)--(dummy2)|-(react1);

\coordinate (zz) at ([yshift=8mm]mater2.north);
\draw[->, ultra thick, draw=orange!50](zz)--(react1.west|-zz);


\end{tikzpicture}

\end{document}

您的代码改进了:

\documentclass[tikz]{standalone}
\usetikzlibrary{positioning}

\tikzset{inpro/.style={circle, thick, draw=yellow!50, fill=yellow!20, minimum size=3mm},
        mater/.style = {rectangle, thick, draw=green!50, fill=green!20, minimum width=2.25cm,
             minimum height=.5cm, text centered},
        react/.style = {rectangle, thick, draw=cyan!50, fill=cyan!20, minimum width=2cm,
             minimum height=2cm, text centered, text width=2cm}
}

\begin{document}
\begin{tikzpicture}[node distance=2.5cm,font=\tiny]
\node(mater)[mater]{bubble1};
\node(inpro1)[inpro, below=1cm of mater]{bubble2};
\node(inpro2)[inpro, right = of inpro1]{bubble3};
\node(mater2)[mater, below = 2cm of inpro1]{bubble4};
\node(react1)[react, below right=1.2cm and 4cm of mater]{bubble5};


\draw[->, ultra thick, draw=orange!50](mater)--(inpro1);
\draw[->, ultra thick, draw=orange!50](inpro1)--(inpro2);
\draw[->, ultra thick, draw=orange!50](inpro2)--(react1.west|-inpro2);  %%% here
\draw[->, ultra thick, draw=orange!50, dashed](mater2.north)|-([yshift=-2mm]react1.west);

\draw[->, ultra thick, draw=orange!50](mater2.north|-react1.210)--(react1.210);

\end{tikzpicture}

\end{document}

在此处输入图片描述

相关内容