I'm a newbie making a simple flow diagram using relative positioning and on grid
. My diagram is simple, so I expected everything to line up easily. But I'm getting this:
I'm trying to draw arrows from the right-most nodes to some invisible placeholder nodes on the right margin (using [coordinate]
), and I'm lining those up relative to the center line. But something is wonky.
Am I missing something basic? My code:
\documentclass[letterpaper,11pt,reqno]{amsart}
\usepackage{tikz}
\usetikzlibrary{positioning,shapes.geometric}
\begin{document}
\begin{tikzpicture}[nodes = {draw,font=\ttfamily\footnotesize, inner sep = 1pt}, on grid]
% nodes on the main line + coordinate placeholders
\node [circle] (1) {1};
\node [circle, right=10mm of 1] (2) {2};
\node [coordinate, right=10mm of 2] (3g) { };
\node [circle, right=10mm of 3g] (6) {6};
\node [coordinate, right=10mm of 6] (7g) { };
\node [coordinate, right=10mm of 7g] (8g) { };
\node [coordinate, right=10mm of 8g] (9g) { };
% other nodes
\node [circle, below=1cm of 3g] (3) {3};
\node [circle, below=1cm of 7g] (7) {7};
\node [circle, above=1cm of 8g] (8) {8};
\node [circle, below=2cm of 9g] (9) {9};
% right edge coordinate placeholders
\node [coordinate, right=10mm of 9g] (edge) { };
\node [coordinate, above=1cm of edge] (edge_above) { };
\node [coordinate, below=1cm of edge] (edge_below1) { };
\node [coordinate, below=2cm of edge] (edge_below2) { };
% paths
\path[draw]
(1) -- (2)
(2) -- (6)
(2) |- (3)
(3) -- (7)
(7) |- (9)
(6) |- (8);
% right arrows
\path[draw, ->] (8) -> (edge_above);
\path[draw, ->] (6) -> (edge);
\path[draw, ->] (7) -> (edge_below1);
\path[draw, ->] (9) -> (edge_below2);
\end{tikzpicture}
\end{document}