I'm trying to put a adjacency matrix beneath a graph using subfloat
. The graph is drawn with tikz
. No matter what I do, the matrix is put below the graph as shown here:
The code is here:
\begin{figure}[h]
\centering
\subfloat{
\begin{tikzpicture}[-,>=stealth',shorten >=1pt,auto,node distance=2cm,
thick,main node/.style={circle,fill=black!20,draw}]
\node[main node] (1) {$v_2$};
\node[main node] (2) [below left of=1] {$v_1$};
\node[main node] (3) [below right of=1] {$v_3$};
\node[main node] (4) [below of=3] {$v_4$};
\node[main node] (5) [below of=2] {$v_5$};
\path[every node/.style={font=\sffamily\small}]
(2) edge node [left] {} (1)
(2) edge node [left] {} (3)
(1) edge node [left] {} (5)
(1) edge node [left] {} (3)
(3) edge node [left] {} (4)
(4) edge node [left] {} (5)
;
\end{tikzpicture}}
\subfloat{
\begin{math}
A_{G} = \left(
\begin{array}{ccccc}
0 & 1 & 1 & 0 & 0 \\
1 & 0 & 1 & 0 & 1 \\
1 & 1 & 0 & 1 & 0 \\
0 & 0 & 1 & 0 & 1 \\
0 & 1 & 0 & 1 & 0
\end{array}
\right)
\end{math}
}
\caption{\textbf{Sample graph and adjacency matrix.} Example graph with 5 vertices and 5 edges and its adjacency matrix $A_{G}$}
\label{fig: example graph for modularity calculation}
\end{figure}
Does anybody have an idea, why this happens and how I can prevent it?
baseline=(current bounding box.center)
. But can also be any other coordinate for positioning.