6

Attached below is the minimum working example. I would like the arrow to end at the west anchor of the node "operation". I tried anchor and few other possibilities but they don't seem to affect the edge position.

\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}

output

3
  • Please ensure that the posted code can be cut and pasted to into a document. The version you had posted had all the square brackets escaped fro some reason. Apr 16, 2013 at 19:41
  • \path node[operator, below=of uncurated] (schematize) {operation} (schematize.west) edge[<-,thick] node[auto]{\tiny flow} (uncurated.south); works for me. Apr 16, 2013 at 19:44
  • Actually, this solution works better. Thanks.
    – Kabira K
    Apr 16, 2013 at 20:54

2 Answers 2

7

It might be easier to just use a separate draw command and specify the in= and out= angles:

enter image description here

Code:

\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}
5
  • That works. Thanks so much. For some reason reading the manual didn't give me a hint that I could mix the draw and edge primitives.
    – Kabira K
    Apr 16, 2013 at 19:45
  • @Sandeep You shouldn't. Use \path if you use edge and not \draw. Do you see the lonely blue up-arrow at the content node? Apr 16, 2013 at 19:47
  • @Qrrbrbirlbel by lonely you mean the arrow head is dislodged from trunk of the arrow? If so, yes. Will you path and edge.
    – Kabira K
    Apr 16, 2013 at 20:18
  • @Sandeep Yes, that's caused by using \draw and edge together. The reason is a zero-length line from and to (uncurated.south). The calculated direction for such a zero-length line is 90° (atan(∞)). The edge operator creates sub-paths. Apr 16, 2013 at 20:27
  • @Qrrbrbirlbel: Thanks, I did not know that one should use \path instead of \draw with an edge. I normally don't use edge and am used to using to instead. Apr 16, 2013 at 21:10
2

Sometimes the easiest way to achieve the good results in TikZ is to place nodes first and then draw the lines:

\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}

compiled code

Note that you do not have to use anchors always (e.g., below=of uncurated is the same as below=of uncurated.south and placing only node names in \draw allow TikZ to calculate the anchors automagically.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .