# Aligning Graphics inside a Tikz Node?

I'd like the top of the first image to align with the top of the table, and then the second image's right side to align as well.

See crappy paint drawing for reference:

Code:

    \begin{center}
\begin{tikzpicture}[->,scale=9.5, auto,swap]

% Draw the vertices.
\node (a) at (0,0) {Next Configuration};
\node (b) at (0,1) {%

\rowcolors{2}{}{SeaGreen!30}%
\begin{tabular}{ b{.015\textwidth} | c }
& Parameter Name (units) \\ \hline
\parbox[c]{2em}{$1$} & $x_{1}$ \\
\parbox[c]{2em}{$2$} & $x_{2}$ \\
\parbox[c]{2em}{$3$} & $x_{3}$ \\
\parbox[c]{2em}{$4$} & $x_{4}$ \\
\parbox[c]{2em}{$5$} & $x_{5}$ \\
\parbox[b]{2em}{$...$} & $...$ \\
\parbox[c]{2em}{$n$} & $x_{n}$ \\
\end{tabular}};

\node (c) at (1,1) {\includegraphics[width = 2.25in]{model.png}};
\node (d) at (1, 0.4) {\includegraphics{update.png}};
\node (e) at (1,0) {\includegraphics[width = 2.75in]{measurement.png}};

% Connect vertices with edges and draw weights
\path (a) edge node {} (b);
\path (b) edge node {} (c);
\path (c) edge node {} (d);
\path (d) edge node {} (e);
\path (e) edge node {} (a);

\end{tikzpicture}
\end{center}


Ideas?

• Please make from your code snippet complete document which we can compile. – Zarko Aug 23 '16 at 17:11

I had to replace the images with placeholders because I don't have them. Also, please add the preamble next time with all the relevant packages and libraries for the example you post.

The colored lines is for you to check that the nodes are aligned. In my code I also changed the size of the images to resemble your example image, but even if you restore those to normal, everything should align. Also, to set a columns width along with the \centering, I think a more appropriate solution is to use the array package.

Finally, I think there might be better ways to draw a graph like this, but my solution only focused on fixing your problem.

## Code

\documentclass[tikz,margin=10pt]{standalone}
%\usepackage{xcolor}
\usepackage{array}

\usetikzlibrary{calc}

\tikzset{
img/.style={inner sep=0, outer sep=0}
}

\begin{document}
\begin{tikzpicture}[->,scale=9.5, auto,swap]

% Draw the vertices.
\node (a) at (0,0) {Next Configuration};
\node (b) at (0,1) {%
%\rowcolors{2}{}{green!30}%
\begin{tabular}{ >{\centering\arraybackslash}b{1em} | c }
& Parameter Name (units) \\ \hline
$1$ & $x_{1}$ \\
$2$ & $x_{2}$ \\
$3$ & $x_{3}$ \\
$4$ & $x_{4}$ \\
$5$ & $x_{5}$ \\
$...$ & $...$ \\
$n$ & $x_{n}$ \\
\end{tabular}};

\node[anchor=north, img] (c) at ($(b.north)+(1,0)$) {\includegraphics[width = 2.25in, height=3cm]{example-image-a}};

\node (d) at (1, 0.4) {\includegraphics[width=2.5cm, height=5mm]{example-image-a}};
\node[anchor=east, img] (e) at (c.east|-a.east) {\includegraphics[width = 2.75in, height=2cm]{example-image-a}};

% Connect vertices with edges and draw weights
\draw (a) -- (b);
\draw (b) -- (b-|c.west);
\draw (c) -- (d);
\draw (d) -- (d|-e.north);
\draw (e) -- (e-|a.east);

% lines to check alignment
\begin{scope}[very thick, -]
\draw[green] (b.north west) -| (b.south east);
\draw[red] (b.north east) --++ (1.2,0);
\draw[red] (c.south east) --++ (0,-1);
\end{scope}
\end{tikzpicture}
\end{document}