![流程图 - 连接节点的箭头](https://linux22.com/image/374658/%E6%B5%81%E7%A8%8B%E5%9B%BE%20-%20%E8%BF%9E%E6%8E%A5%E8%8A%82%E7%82%B9%E7%9A%84%E7%AE%AD%E5%A4%B4.png)
我是 TikZ 的新手,在制作节点之间的连接箭头时遇到了一些麻烦......
这是我的代码:
% Define block styles
\tikzstyle{decision} = [diamond, draw, fill=blue!20,
text width=4.5em, text badly centered, node distance=3cm, inner sep=0pt]
\tikzstyle{block} = [rectangle, draw, fill=blue!20,text width=8em, text centered, rounded corners, minimum height=4em]
\tikzstyle{line} = [draw, -latex']
\tikzstyle{cloud} = [draw, ellipse,fill=red!20, node distance=3cm, minimum height=2em]
\begin{figure}
\begin{tikzpicture} [node distance = 2.5cm, auto]
\node [block] (init) {Temperering av melk};
\node [block, below of=init] (init1) {Kulturtilsetning};
\node [block, below of=init1] (init2) {Formodning};
\node [block, below of=init2] (init3) {L{\o}petilsetning};
\node [block, below of=init3] (init4) {Koagulering};
\node [block, below of=init4] (init5) {Skj{\ae}ring};
\node [block, below of=init5] (init6) {R{\o}ring};
\node [block, right of=init,node distance=5cm] (init7) {Forming};
\node [block, right of=init1,node distance=5cm] (init8){Drenering/Syrning};
\node [block, right of=init2,node distance=5cm] (init9) {Vending};
\node [block, right of=init3,node distance=5cm] (init10) {Salting};
\node [block, right of=init4,node distance=5cm] (init11) {Modning};
\node [block, right of=init5,node distance=5cm] (init12) {Prikking};
\node [block, right of=init6,node distance=5cm] (init13) {Pakking};
\node [block,right of=init7,node distance=5cm] (init14) {Ettermodning};
\path [line] (init) -- (init1);
\path [line] (init1) -- (init2);
\path [line] (init2) -- (init3);
\path [line] (init3) -- (init4);
\path [line] (init4) -- (init5);
\path [line] (init5) -- (init6);
\path [line, rounded corners] (init6) |- (init7);
\path [line] (init7) -- (init8);
\path [line] (init8) -- (init9);
\path [line] (init9) -- (init10);
\path [line] (init10) -- (init11);
\path [line] (init11) -- (init12);
\path [line] (init12) -- (init13);
\path [line, rounded corners] (init13) -| (init14);
\end{tikzpicture}
\end{figure}
这是我的输出,其中红线/箭头代表我想要包含的箭头。
有人知道如何制作这些箭头吗?
答案1
您只需稍微改变一下线路规格即可。
例如,你有:
\path [line, rounded corners] (init6) |- (init7);
这句话告诉 Ti钾Z 向上 ( |
) 然后向右 ( -
) 从init6
到init7
。
首先要改变的是,你想向右走,然后向上走,所以-|
。但只有这样才能将箭头的垂直部分粘到框上,所以我们告诉 Ti钾init6
Z 从( )的右边缘开始(init6.east)
,1cm
向右移动 ( ),然后向上和向右移动到( )-- ++ (1cm,0)
的左边缘:init7
|- (init7.west)
\path [line, rounded corners] (init6.east) -- ++ (1cm,0) |- (init7.west);
另一支箭也同样如此。
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{arrows}
\begin{document}
% Define block styles
\tikzstyle{decision} = [diamond, draw, fill=blue!20,
text width=4.5em, text badly centered, node distance=3cm, inner sep=0pt]
\tikzstyle{block} = [rectangle, draw, fill=blue!20,text width=8em, text centered, rounded corners, minimum height=4em]
\tikzstyle{line} = [draw, -latex']
\tikzstyle{cloud} = [draw, ellipse,fill=red!20, node distance=3cm, minimum height=2em]
\begin{figure}
\begin{tikzpicture} [node distance = 2.5cm, auto]
\node [block] (init) {Temperering av melk};
\node [block, below of=init] (init1) {Kulturtilsetning};
\node [block, below of=init1] (init2) {Formodning};
\node [block, below of=init2] (init3) {L{\o}petilsetning};
\node [block, below of=init3] (init4) {Koagulering};
\node [block, below of=init4] (init5) {Skj{\ae}ring};
\node [block, below of=init5] (init6) {R{\o}ring};
\node [block, right of=init,node distance=5cm] (init7) {Forming};
\node [block, right of=init1,node distance=5cm] (init8){Drenering/Syrning};
\node [block, right of=init2,node distance=5cm] (init9) {Vending};
\node [block, right of=init3,node distance=5cm] (init10) {Salting};
\node [block, right of=init4,node distance=5cm] (init11) {Modning};
\node [block, right of=init5,node distance=5cm] (init12) {Prikking};
\node [block, right of=init6,node distance=5cm] (init13) {Pakking};
\node [block,right of=init7,node distance=5cm] (init14) {Ettermodning};
\path [line] (init) -- (init1);
\path [line] (init1) -- (init2);
\path [line] (init2) -- (init3);
\path [line] (init3) -- (init4);
\path [line] (init4) -- (init5);
\path [line] (init5) -- (init6);
\path [line, rounded corners] (init6.east) -- ++ (1cm,0) |- (init7.west);
\path [line] (init7) -- (init8);
\path [line] (init8) -- (init9);
\path [line] (init9) -- (init10);
\path [line] (init10) -- (init11);
\path [line] (init11) -- (init12);
\path [line] (init12) -- (init13);
\path [line, rounded corners] (init13.east) -- ++ (1cm,0) |- (init14.west);
\end{tikzpicture}
\end{figure}
\end{document}