[Tex/LaTex] Table overlay in beamer on multiple rows

beameroverlaystables

I want to include a table in my presentation (beamer) and this table has 2 panels. I want to first show the first panel and then the second panel, I have been trying to do it unfortunately without any luck. The table is like as shown below (I want to first show the results for $\alpha=0.05$ and then $\alpha=0.5$):

\begin{frame}
\begin{table}
\caption{Table}
\begin{tabular}{l c c c c c c}
\hline \hline
No.  & {Ordinary} & {Blue} & {Pink} & {Yellow} & {Green} & {RCM}\\
\hline
&\multicolumn{6}{c}{$\alpha$=0.05}\\
H=2     &     95.0 &    75.3    &   75.7    &   79.5    &   72.0    &\\
H=3 & 95.6 &    87.0    &   87.3    &   87.6    &   85.2    &\\
H=4 & 95.0 &    91.6    &   91.9    &   90.3    &   90.2    & 93.3\\
H=5 & 95.2 &    93.5    &   93.7    &   91.3    &   91.8    & 94.3\\
H=6 & 94.9 &    93.8    &   94.1    &   92.6    &   92.8    & 94.7\\

&\multicolumn{6}{c}{$\alpha$=0.5}\\

H=2 & 95.0  &   91.4    &   91.2    &   79.5    &   99.9    &   \\
H=3 & 95.6  &   95.1    &   95.1    &   87.6    &   95.1    &   \\
H=4 & 95.0  &   94.8    &   94.8    &   90.3    &   93.5    & 95.5  \\
H=5 & 95.2  &   95.1    &   95.2    &   91.3    &   93.1    & 95.9  \\
H=6 & 94.9  &   94.8    &   94.8    &   92.6    &   93.4    & 95.5  \\
\hline
\end{tabular}
\end{table}
\end{frame}

Best Answer

Perhaps the simpler solution in this case is to use \only:

\documentclass{beamer}

\begin{document}

\begin{frame}
\begin{table}
\caption{Table}
\begin{tabular}{l c c c c c c}
\hline \hline
No.  & {Ordinary} & {Blue} & {Pink} & {Yellow} & {Green} & {RCM}\\
\hline
\only<1>{
&\multicolumn{6}{c}{$\alpha$=0.05}\\
H=2     &     95.0 &    75.3    &   75.7    &   79.5    &   72.0    &\\
H=3 & 95.6 &    87.0    &   87.3    &   87.6    &   85.2    & \\
H=4 & 95.0 &    91.6    &   91.9    &   90.3    &   90.2    & 93.3\\
H=5 & 95.2 &    93.5    &   93.7    &   91.3    &   91.8    & 94.3\\
H=6 & 94.9 &    93.8    &   94.1    &   92.6    &   92.8    & 94.7 \\[-\normalbaselineskip]
}
\only<2>{
&\multicolumn{6}{c}{$\alpha$=0.5}\\
H=2 & 95.0  &   91.4    &   91.2    &   79.5    &   99.9    &   \\
H=3 & 95.6  &   95.1    &   95.1    &   87.6    &   95.1    &   \\
H=4 & 95.0  &   94.8    &   94.8    &   90.3    &   93.5    & 95.5  \\
H=5 & 95.2  &   95.1    &   95.2    &   91.3    &   93.1    & 95.9  \\
H=6 & 94.9  &   94.8    &   94.8    &   92.6    &   93.4    & 95.5 \\[-\normalbaselineskip]
}
\\\hline
\end{tabular}
\end{table}
\end{frame}

\end{document}

enter image description here

Or a simple variation showing each part separately and finally the whole table:

\documentclass{beamer}

\begin{document}

\begin{frame}
\begin{table}
\caption{Table}
\begin{tabular}{l c c c c c c}
\hline \hline
No.  & {Ordinary} & {Blue} & {Pink} & {Yellow} & {Green} & {RCM}\\
\hline
\only<1,3>{
&\multicolumn{6}{c}{$\alpha$=0.05}\\
H=2     &     95.0 &    75.3    &   75.7    &   79.5    &   72.0    &\\
H=3 & 95.6 &    87.0    &   87.3    &   87.6    &   85.2    & \\
H=4 & 95.0 &    91.6    &   91.9    &   90.3    &   90.2    & 93.3\\
H=5 & 95.2 &    93.5    &   93.7    &   91.3    &   91.8    & 94.3\\
H=6 & 94.9 &    93.8    &   94.1    &   92.6    &   92.8    & 94.7 \\[-\normalbaselineskip]
}\only<3>{\\}
\only<2,3>{
&\multicolumn{6}{c}{$\alpha$=0.5}\\
H=2 & 95.0  &   91.4    &   91.2    &   79.5    &   99.9    &   \\
H=3 & 95.6  &   95.1    &   95.1    &   87.6    &   95.1    &   \\
H=4 & 95.0  &   94.8    &   94.8    &   90.3    &   93.5    & 95.5  \\
H=5 & 95.2  &   95.1    &   95.2    &   91.3    &   93.1    & 95.9  \\
H=6 & 94.9  &   94.8    &   94.8    &   92.6    &   93.4    & 95.5 \\[-\normalbaselineskip]
}
\\\hline
\end{tabular}
\end{table}
\end{frame}

\end{document}

enter image description here

Another possibility, producing a different kind of overlay, is to use \onslide:

\documentclass{beamer}

\begin{document}

\begin{frame}
\begin{table}
\caption{Table}
\begin{tabular}{l c c c c c c}
\hline \hline
No.  & {Ordinary} & {Blue} & {Pink} & {Yellow} & {Green} & {RCM}\\
\hline
\onslide<1->{
&\multicolumn{6}{c}{$\alpha$=0.05}\\
H=2     &     95.0 &    75.3    &   75.7    &   79.5    &   72.0    &\\
H=3 & 95.6 &    87.0    &   87.3    &   87.6    &   85.2    & \\
H=4 & 95.0 &    91.6    &   91.9    &   90.3    &   90.2    & 93.3\\
H=5 & 95.2 &    93.5    &   93.7    &   91.3    &   91.8    & 94.3\\
H=6 & 94.9 &    93.8    &   94.1    &   92.6    &   92.8    & 94.7 \\
}
\onslide<2>{
&\multicolumn{6}{c}{$\alpha$=0.5}\\
H=2 & 95.0  &   91.4    &   91.2    &   79.5    &   99.9    &   \\
H=3 & 95.6  &   95.1    &   95.1    &   87.6    &   95.1    &   \\
H=4 & 95.0  &   94.8    &   94.8    &   90.3    &   93.5    & 95.5  \\
H=5 & 95.2  &   95.1    &   95.2    &   91.3    &   93.1    & 95.9  \\
H=6 & 94.9  &   94.8    &   94.8    &   92.6    &   93.4    & 95.5 \\[-\normalbaselineskip]
}
\\\hline
\end{tabular}
\end{table}
\end{frame}

\end{document}

enter image description here