I generally have problems working within the figure and table environments. For my thesis I am using xtable
to output my R data into latex code. I have three matrices that I would like to stack like the following picture:
Here is my current attempt but the error is `Not in outer par mode. \begin
\begin{figure}
\centering
\begin{subfigure}[b]{0.3\textwidth}
\centering
\begin{table}
\begin{tabular}{rrrrrrrrrrr}
\hline
& 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 \\
\hline
A & 0.10 & -1.64 & 1.17 & 0.50 & 0.81 & 0.63 & 1.00 & 0.31 & 1.00 & 0.07 \\
C & 0.55 & 0.30 & -1.87 & -1.48 & -2.97 & -2.72 & -1.86 & -2.01 & -3.26 & -1.39 \\
G & -1.72 & -2.75 & -1.35 & -1.70 & -2.65 & -2.54 & -2.93 & -1.59 & 0.11 & 0.88 \\
T & -0.01 & 0.87 & -1.03 & 0.66 & 0.49 & 0.68 & 0.07 & 0.83 & -2.04 & -1.31 \\
\hline
\end{tabular}
\end{table}
\caption{$y=x$}
\label{fig:y equals x}
\end{subfigure}
\centering
\begin{subfigure}[b]{0.3\textwidth}
\centering
\begin{table}
\begin{tabular}{rrrrrrrrrrr}
\hline
& 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 \\
\hline
A & 518 & 91 & 1515 & 773 & 1054 & 880 & 1276 & 637 & 1272 & 502 \\
C & 809 & 631 & 72 & 107 & 24 & 31 & 73 & 63 & 18 & 117 \\
G & 84 & 30 & 121 & 86 & 33 & 37 & 25 & 96 & 524 & 1130 \\
T & 464 & 1123 & 167 & 909 & 764 & 927 & 501 & 1079 & 61 & 126 \\
\hline
\end{tabular}
\end{table}
\caption{$y=x$}
\label{fig:y equals x}
\end{subfigure}
\hfill
\begin{subfigure}[b]{0.3\textwidth}
\centering
\begin{table}[ht]
\begin{tabular}{rrrrrrrrrrr}
\hline
& 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 \\
\hline
A & 0.28 & 0.05 & 0.81 & 0.41 & 0.56 & 0.47 & 0.68 & 0.34 & 0.68 & 0.27 \\
C & 0.43 & 0.34 & 0.04 & 0.06 & 0.01 & 0.02 & 0.04 & 0.03 & 0.01 & 0.06 \\
G & 0.04 & 0.02 & 0.06 & 0.05 & 0.02 & 0.02 & 0.01 & 0.05 & 0.28 & 0.60 \\
T & 0.25 & 0.60 & 0.09 & 0.48 & 0.41 & 0.49 & 0.27 & 0.58 & 0.03 & 0.07 \\
\hline
\end{tabular}
\end{table}
\caption{$y=3sinx$}
\label{fig:three sin x}
\end{subfigure}
\hfill
\caption{Three simple graphs}
\label{fig:three graphs}
\end{figure}
Best Answer
Here's a solution that uses three
subtable
environments (provided by thesubcaption
package) inside atable
environment. (Since the material appears to be all tabular, I suggest usingtable
andsubtable
environments instead offigure
andsubfigure
environments.) I use\bigskip
instructions to provide a bit more vertical separation between thesubtable
environments.The code below also uses the line-drawing macros of the
booktabs
package for lines that have better vertical spacing than\hline
, as well as theS
column type (provided by thesiunitx
package) for the ten numeric data columns.