Position two stacked tikz matrices
A matrix
is just really a node
, so if you name the top matrix (Top)
then you can use below of=Top
in the other matrix to position it:
Code:
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{matrix}
\begin{document}
\begin{tikzpicture}
\matrix [matrix of nodes,row sep=-\pgflinewidth,column 2/.style={nodes={rectangle,draw,minimum width=3em}}] (Top)
{
0 & 6 \\
};
\matrix [matrix of nodes,row sep=-\pgflinewidth,column 2/.style={nodes={rectangle,draw,minimum width=3em}}, below of=Top]
{
1 & 3 \\
};
\end{tikzpicture}
\end{document}
You can also use a scope
and shift the entire content.
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{matrix}
\begin{document}
\begin{tikzpicture}
\matrix [matrix of nodes,row sep=-\pgflinewidth,column 2/.style={nodes={rectangle,draw,minimum width=3em}}]
{
0 & 6 \\
};
\begin{scope}[yshift=-1cm]
\matrix [matrix of nodes,row sep=-\pgflinewidth,column 2/.style={nodes={rectangle,draw,minimum width=3em}}]
{
1 & 3 \\
};
\end{scope}
\end{tikzpicture}
\end{document}