锚箭头起始位置

锚箭头起始位置

下面附有最小工作示例。我希望箭头在节点“操作”的西锚点处结束。我尝试了锚点和其他几种可能性,但它们似乎不会影响边缘位置。

\documentclass{article}  
\usepackage{tikz}  
\usetikzlibrary{shapes,positioning}  
\begin{document}    
\tikzstyle{data}=[circle,shade,fill=blue!60, draw]
\tikzstyle{operator}=[shape=rectangle, rounded corners, fill=cyan, draw=cyan]   

\begin{tikzpicture}
\node[data] (uncurated) {content};  
\path node[operator] (schematize) [below = of uncurated.south]{operation}
edge[<-,thick]  node[auto]{\tiny flow} (uncurated.south);  
\end{tikzpicture}  
\end{document}

输出

答案1

使用单独的绘图命令并指定in=out=角度可能会更容易:

在此处输入图片描述

代码:

\documentclass{article}  
\usepackage{tikz}  
\usetikzlibrary{shapes,positioning}  
\begin{document}    
\tikzstyle{data}=[circle,shade,fill=blue!60, draw]
\tikzstyle{operator}=[shape=rectangle, rounded corners, fill=cyan, draw=cyan]   

\begin{tikzpicture}
\node[data] (uncurated) {content};  
\path node[operator] (schematize) [below = of uncurated.south]{operation}
edge[<-,thick]  node[auto]{\tiny flow} (uncurated.south);  
\path [->, thick, red] (uncurated.south) edge (schematize.west);
\end{tikzpicture}  
\begin{tikzpicture}
\node[data] (uncurated) {content};  
\path node[operator] (schematize) [below = of uncurated.south]{operation}
edge[<-,thick]  node[auto]{\tiny flow} (uncurated.south);  
\path [->, thick, blue] (uncurated.south) edge[out=-145, in=180] (schematize.west);
\end{tikzpicture}  
\end{document}

答案2

有时在 TikZ 中获得良好效果的最简单方法是先放置节点,然后绘制线条:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{shapes,positioning}
\begin{document}
\tikzstyle{data}=[circle,shade,fill=blue!60, draw]
\tikzstyle{operator}=[shape=rectangle, rounded corners, fill=cyan, draw=cyan]
\begin{tikzpicture}
\node [data] (uncurated) {content};
\node [operator] (schematize) [below=of uncurated] {operation};
\draw [-stealth] (uncurated) -- node [auto, swap] {\tiny flow} (schematize);
\end{tikzpicture}
\begin{tikzpicture}
\node [data] (uncurated) {content};
\node [operator] (schematize) [below=of uncurated] {operation};
\draw [-stealth] (uncurated) -- node [auto, swap] {\tiny flow} (schematize.west);
\end{tikzpicture}
\end{document}

编译代码

请注意,您不必始终使用锚点(例如,below=of uncurated与 相同,below=of uncurated.south并且仅放置节点名称即可\draw允许 TikZ 自动计算锚点。

相关内容