在绘制节点连接的时候我比较困惑。
\usepackage{xcolor}
\definecolor{darkblue}{HTML}{1F4E79}
\definecolor{salmon}{HTML}{FF9C6B}
\tikzstyle{cell} = [rectangle, minimum width=1cm, minimum height=0.5cm,text centered, draw=black, fill=salmon]
\tikzstyle{state} = [rectangle, minimum width=1cm, minimum height=0.5cm,text centered, draw=black, fill=darkblue]
\tikzstyle{arrow} = [thick,->,>=stealth]
\begin{tikzpicture}[thick,scale=0.8, every node/.style={scale=0.8},node distance=1.5cm]
\node (0) [state] {\textcolor{white}{feature extraction}};
\node (1) [cell, below of=0] {invertBotConE2\_f48\_k1\_b4\_noskip};
\node (2) [cell, below of=1] {invertBotConE2\_f16\_k3\_b4\_noskip};
\draw [arrow] (0) -- (1);
\draw [arrow] (1) -- (2);
\draw (0.east) [arrow] edge [out=0, in=0, out looseness=4, in looseness=4] (2.north);
\end{tikzpicture}
0,2 是我的节点。east
指定时,它会在节点 0 上创建一个箭头。如果删除,它会消失。如果我想将其0.south
作为边的起点怎么办?
答案1
使用to
而不是edge
。
\documentclass[tikz,border=3.14mm]{standalone}
\usepackage{xcolor}
\definecolor{darkblue}{HTML}{1F4E79}
\definecolor{salmon}{HTML}{FF9C6B}
\tikzset{cell/.style={rectangle, minimum width=1cm, minimum height=0.5cm,text
centered, draw=black, fill=salmon},
state/.style={rectangle, minimum width=1cm, minimum height=0.5cm,text
centered, draw=black, fill=darkblue},
arrow/.style={thick,->,>=stealth}}
\begin{document}
\begin{tikzpicture}[thick,scale=0.8, every node/.style={scale=0.8},node distance=1.5cm]
\node (0) [state] {\textcolor{white}{feature extraction}};
\node (1) [cell, below of=0] {invertBotConE2\_f48\_k1\_b4\_noskip};
\node (2) [cell, below of=1] {invertBotConE2\_f16\_k3\_b4\_noskip};
\draw [arrow] (0) -- (1);
\draw [arrow] (1) -- (2);
\draw (0.east) [arrow] to[out=0, in=0, out looseness=4, in looseness=4] (2.north);
\end{tikzpicture}
\end{document}
或者使用适当的语法edge
。
\documentclass[tikz,border=3.14mm]{standalone}
\usepackage{xcolor}
\definecolor{darkblue}{HTML}{1F4E79}
\definecolor{salmon}{HTML}{FF9C6B}
\tikzset{cell/.style={rectangle, minimum width=1cm, minimum height=0.5cm,text
centered, draw=black, fill=salmon},
state/.style={rectangle, minimum width=1cm, minimum height=0.5cm,text
centered, draw=black, fill=darkblue},
arrow/.style={thick,->,>=stealth}}
\begin{document}
\begin{tikzpicture}[thick,scale=0.8, every node/.style={scale=0.8},node distance=1.5cm]
\node (0) [state] {\textcolor{white}{feature extraction}};
\node (1) [cell, below of=0] {invertBotConE2\_f48\_k1\_b4\_noskip};
\node (2) [cell, below of=1] {invertBotConE2\_f16\_k3\_b4\_noskip};
\draw [arrow] (0) -- (1);
\draw [arrow] (1) -- (2);
\draw (0.east) edge[arrow,out=0, in=0, out looseness=4, in looseness=4] (2.north);
\end{tikzpicture}
\end{document}
(尝试)解释:edge
插入新路径。因此,您有两条路径和两个箭头。