\begin{figure}
\begin{center}
\begin{tikzpicture}[font=\sffamily,boxed/.style={minimum width=1.7cm,minimum height=1cm,draw,thick,text width=1.9cm,text centered},node distance=.3cm]
\begin{scope}[local bounding box=upper]
\begin{scope}[start chain=1 going below,every join/.style={-latex,thick},frm/.style={boxed,on chain=1,join}]
\node[on chain=1](n0) {Training };
\node[frm](n1) {\scriptsize Construct one gait cycle from all subjects};
\node[frm](n2) {\scriptsize Find for each subject};
\node[frm](n3) {\scriptsize Construct set of global};
\node[frm](n4) {\scriptsize Compute data set domain };
\end{scope}
\node[boxed,right=0.7cm of n1] (n7) {\scriptsize Find feature};
\node[boxed,right=.7cm of n2] (n8) {\scriptsize Passed through auto-encoder};
\node at (n0-|n8) (n9) {Test };
\node[boxed,right=0.7cm of n3] (n10) {\scriptsize Classify data through };
\node[boxed,right=0.25cm of n4] (n11) {\scriptsize Trained auto-encoder};
\node[below=2.5cm of n10, trapezium,trapezium left angle=60,trapezium right angle=120,
minimum width=1cm,minimum height=.5cm,draw,thick] (n14) {\scriptsize Final class};
\end{scope}
\begin{scope}[every edge/.style={draw,-latex,thick}]
\path
(n9) edge (n7)
(n7) edge (n8)
(n8) edge (n10)
(n4) edge (n11)
(n11.north-|n10) edge (n10)
(n10) edge (n14);
\end{scope}
\end{tikzpicture}
\end{center}
\caption{}
\label{fig:block1}
\end{figure}
在这段代码中,我想将节点 n10 和节点 n14 之间的线以右对齐方式连接起来,这样该线就不会穿过节点 n11。
我该怎么做呢?
答案1
像这样?您可以使用xshift
。我还稍微重新排列了您的图表。
\documentclass[tikz,border=3.14mm]{standalone}
\usetikzlibrary{positioning,chains,shapes.geometric}
\begin{document}
\begin{tikzpicture}[font=\sffamily,boxed/.style={minimum width=1.7cm,minimum height=1cm,draw,thick,text width=1.9cm,text centered},node distance=.3cm]
\begin{scope}[local bounding box=upper]
\begin{scope}[start chain=1 going below,every join/.style={-latex,thick},frm/.style={boxed,on chain=1,join}]
\node[on chain=1](n0) {Training };
\node[frm](n1) {\scriptsize Construct one gait cycle from all subjects};
\node[frm](n2) {\scriptsize Find for each subject};
\node[frm](n3) {\scriptsize Construct set of global};
\node[frm](n4) {\scriptsize Compute data set domain };
\end{scope}
\node[boxed,right=0.7cm of n1] (n7) {\scriptsize Find feature};
\node[boxed,right=.7cm of n2] (n8) {\scriptsize Passed through auto-encoder};
\node at (n0-|n8) (n9) {Test };
\node[boxed,right=0.7cm of n3] (n10) {\scriptsize Classify data through };
\node[boxed,right=0.25cm of n4] (n11) {\scriptsize Trained auto-encoder};
\node[below=2.5cm of n10, trapezium,trapezium left angle=60,trapezium right angle=120,
minimum width=1cm,minimum height=.5cm,draw,thick] (n14) {\scriptsize Final class};
\end{scope}
\begin{scope}[every edge/.style={draw,-latex,thick}]
\path
(n9) edge (n7)
(n7) edge (n8)
(n8) edge (n10)
(n4) edge (n11)
(n11.north-|n10) edge (n10)
([xshift=-2mm]n10.south east) coordinate(aux) edge (n14.north-|aux);
\end{scope}
\end{tikzpicture}
\end{document}