I have been trying to setup those subtables as 2x5, but it is generated as one subtable per row. I have tried minipage, parbox, resizebox and nothing I know could pack 5 subtables into a single row. The code is shortened to 2x2 example. I would appreciate any sugestions. Thanks :)
\begin{table*}
\centering
\caption{\textcolor{red}{Confusion matrices for well-known pretrained convolutional neural networks}}
\begin{subtable}[h!]{0.18\textwidth}
\centering
\begin{tabular}{ccccc}
& & \multicolumn{3}{c}{Predicted} \\
& \multicolumn{1}{c|}{} & \multicolumn{1}{c|}{K} & \multicolumn{1}{c|}{C} & R \\ \cline{2-5}
\multirow{3}{*}{\rotatebox[origin=c]{90}{Actual}} & \multicolumn{1}{c|}{K} & \multicolumn{1}{c|}{60} & \multicolumn{1}{c|}{5} & 7\\ \cline{2-5}
& \multicolumn{1}{c|}{C} & \multicolumn{1}{c|}{8} & \multicolumn{1}{c|}{82} & 6\\ \cline{2-5}
& \multicolumn{1}{c|}{R} & \multicolumn{1}{c|}{6} & \multicolumn{1}{c|}{3} & 99
\end{tabular}
\subcaption{DenseNet 121}
\label{tab:conf_densenet121}
\end{subtable}
\hfill
\begin{subtable}[h!]{0.18\textwidth}
\centering
\begin{tabular}{ccccc}
& & \multicolumn{3}{c}{Predicted} \\
& \multicolumn{1}{c|}{} & \multicolumn{1}{c|}{K} & \multicolumn{1}{c|}{C} & R \\ \cline{2-5}
\multirow{3}{*}{\rotatebox[origin=c]{90}{Actual}} & \multicolumn{1}{c|}{K} & \multicolumn{1}{c|}{65} & \multicolumn{1}{c|}{2} & 5\\ \cline{2-5}
& \multicolumn{1}{c|}{C} & \multicolumn{1}{c|}{7} & \multicolumn{1}{c|}{86} & 3\\ \cline{2-5}
& \multicolumn{1}{c|}{R} & \multicolumn{1}{c|}{4} & \multicolumn{1}{c|}{3} & 101
\end{tabular}
\subcaption{DenseNet 201}
\label{tab:conf_densenet201}
\end{subtable}
\vskip\baselineskip
\begin{subtable}[b]{0.18\textwidth}
\centering
\begin{tabular}{ccccc}
& & \multicolumn{3}{c}{Predicted} \\
& \multicolumn{1}{c|}{} & \multicolumn{1}{c|}{K} & \multicolumn{1}{c|}{C} & R \\ \cline{2-5}
\multirow{3}{*}{\rotatebox[origin=c]{90}{Actual}} & \multicolumn{1}{c|}{K} & \multicolumn{1}{c|}{63} & \multicolumn{1}{c|}{4} & 5\\ \cline{2-5}
& \multicolumn{1}{c|}{C} & \multicolumn{1}{c|}{5} & \multicolumn{1}{c|}{90} & 1\\ \cline{2-5}
& \multicolumn{1}{c|}{R} & \multicolumn{1}{c|}{3} & \multicolumn{1}{c|}{4} & 101
\end{tabular}
\caption{ResNet50 V2}
\label{tab:conf_resnet50v2}
\end{subtable}
\hfill
\begin{subtable}[b]{0.18\textwidth}
\centering
\begin{tabular}{ccccc}
& & \multicolumn{3}{c}{Predicted} \\
& \multicolumn{1}{c|}{} & \multicolumn{1}{c|}{K} & \multicolumn{1}{c|}{C} & R \\ \cline{2-5}
\multirow{3}{*}{\rotatebox[origin=c]{90}{Actual}} & \multicolumn{1}{c|}{K} & \multicolumn{1}{c|}{62} & \multicolumn{1}{c|}{6} & 4\\ \cline{2-5}
& \multicolumn{1}{c|}{C} & \multicolumn{1}{c|}{7} & \multicolumn{1}{c|}{88} & 1\\ \cline{2-5}
& \multicolumn{1}{c|}{R} & \multicolumn{1}{c|}{2} & \multicolumn{1}{c|}{4} & 102
\end{tabular}
\caption{ResNet152 V2}
\label{tab:conf_resnet152v2}
\end{subtable}
\label{tab:confusion}
\end{table*}
Update
I have substituted subfig
with the actively maintained package subcaption
; the last date subfig
was updated is in 2005.
Here's the new code
\documentclass[journal]{IEEEtran}
\usepackage{xcolor}
\usepackage{multirow}
\usepackage{subcaption}
\usepackage{rotating}
\usepackage[colorlinks]{hyperref}
\usepackage{kantlipsum}
\captionsetup[table]{position=top,skip=12pt}
\captionsetup[subtable]{position=top,aboveskip=3pt}
\newcommand\actual{\multirow{3}{*}{\rotatebox[origin=c]{90}{Actual}}}
\newcommand\predicted{\multicolumn{3}{c}{Predicted}}
\begin{document}
\section{The first section}
\kant[1-5]
Reference to the Table~\ref{tab:conf_resnet}.
References to sub-tables:
\begin{itemize}
\item Table~\ref{tab:conf_densenet121}
\item Table~\ref{tab:conf_densenet201}
\item Table~\ref{tab:conf_densenet2011}
\item Table~\ref{tab:conf_resnet50v2}
\item Table~\ref{tab:conf_resnet152v2}
\item Table~\ref{tab:conf_resnet50v22}
\item Table~\ref{tab:conf_resnet152v22}
\item Table~\ref{tab:conf_resnet152v23}
\end{itemize}
\begin{table*}
\renewcommand*{\arraystretch}{1.35}
\setlength\tabcolsep{4pt}
\caption{\textcolor{red}{Confusion matrices for well-known pretrained convolutional neural networks}}
\label{tab:conf_resnet}
\hfill%
\subfloat[DenseNet 121]{%
\label{tab:conf_densenet121}%
\begin{tabular}{c *4{c|}}
\multicolumn{1}{c}{} & \multicolumn{1}{c}{} & \predicted \\
& & K & C & R \\ \cline{2-5}
\actual & K & 60 & 5 & 7 \\ \cline{2-5}
& C & 8 & 82 & 6 \\ \cline{2-5}
& R & 6 & 3 & 99
\end{tabular}}
\hfill%
\subfloat[DenseNet 201]{%
\label{tab:conf_densenet201}%
\begin{tabular}{c *4{c|}}
\multicolumn{1}{c}{} & \multicolumn{1}{c}{} & \predicted \\
& & K & C & R \\ \cline{2-5}
\actual & K & 65 & 2 & 5 \\ \cline{2-5}
& C & 7 & 86 & 3 \\ \cline{2-5}
& R & 4 & 3 & 101
\end{tabular}}%
\hfill%
\subfloat[DenseNet 201]{%
\label{tab:conf_densenet2011}%
\begin{tabular}{c *4{c|}}
\multicolumn{1}{c}{} & \multicolumn{1}{c}{} & \predicted \\
& & K & C & R \\ \cline{2-5}
\actual & K & 65 & 2 & 5 \\ \cline{2-5}
& C & 7 & 86 & 3 \\ \cline{2-5}
& R & 4 & 3 & 101
\end{tabular}}%
\hspace{\fill}
\vspace{12pt}
\hfill%
\subfloat[ResNet50 V2]{%
\label{tab:conf_resnet50v2}
\begin{tabular}{c *4{c|}}
\multicolumn{1}{c}{} & \multicolumn{1}{c}{} & \predicted \\
& & K & C & R \\ \cline{2-5}
\actual & K & 63 & 4 & 5 \\ \cline{2-5}
& C & 5 & 90 & 1 \\ \cline{2-5}
& R & 3 & 4 & 101
\end{tabular}}%
\hfill%
\subfloat[ResNet152 V2]{%
\label{tab:conf_resnet152v2}
\begin{tabular}{c *4{c|}}
\multicolumn{1}{c}{} & \multicolumn{1}{c}{} & \predicted \\
& & K & C & R \\ \cline{2-5}
\actual & K & 62 & 6 & 4 \\ \cline{2-5}
& C & 7 & 88 & 1 \\ \cline{2-5}
& R & 2 & 4 & 102
\end{tabular}}%
\hspace{\fill}
\vspace{12pt}
\hfill%
\subfloat[ResNet50 V2]{%
\label{tab:conf_resnet50v22}
\begin{tabular}{c *4{c|}}
\multicolumn{1}{c}{} & \multicolumn{1}{c}{} & \predicted \\
& & K & C & R \\ \cline{2-5}
\actual & K & 63 & 4 & 5 \\ \cline{2-5}
& C & 5 & 90 & 1 \\ \cline{2-5}
& R & 3 & 4 & 101
\end{tabular}}%
\hfill%
\subfloat[ResNet152 V2]{%
\label{tab:conf_resnet152v22}
\begin{tabular}{c *4{c|}}
\multicolumn{1}{c}{} & \multicolumn{1}{c}{} & \predicted \\
& & K & C & R \\ \cline{2-5}
\actual & K & 62 & 6 & 4 \\ \cline{2-5}
& C & 7 & 88 & 1 \\ \cline{2-5}
& R & 2 & 4 & 102
\end{tabular}}%
\hfill%
\subfloat[ResNet152 V2]{%
\label{tab:conf_resnet152v23}
\begin{tabular}{c *4{c|}}
\multicolumn{1}{c}{} & \multicolumn{1}{c}{} & \predicted \\
& & K & C & R \\ \cline{2-5}
\actual & K & 62 & 6 & 4 \\ \cline{2-5}
& C & 7 & 88 & 1 \\ \cline{2-5}
& R & 2 & 4 & 102
\end{tabular}}%
\hspace{\fill}
\end{table*}
\end{document}
If each table is going to be exactly the same, you can just use a simple pattern:
\hfill
table \hfill
table \hfill
etc.
If they are going to be different, you can use tabular
instead. Remember, if you want to place elements horizontally, you can't add extra empty lines. It causes LaTeX to start new paragraphs.
I created a grid of 3/2/3 tables. \subfloat[]{}
is also a convenient macro to make sub-captions; it is defined in subfig. Any sub-
related macro is only required if you want to make a reference to each individual table. If you don't, you can safely remove \subfloat
along with subfig.
\documentclass[journal]{IEEEtran}
\usepackage{xcolor}
\usepackage{multirow}
\usepackage{subfig}
\usepackage{rotating}
\usepackage[colorlinks]{hyperref}
\usepackage{kantlipsum}
\captionsetup[table]{position=top,skip=12pt}
\captionsetup[subtable]{position=top,captionskip=2pt}
\begin{document}
\section{The first section}
\kant[1-5]
Reference to the Table~\ref{tab:conf_resnet}.
References to sub-tables:
\begin{itemize}
\item Table~\ref{tab:conf_densenet121}
\item Table~\ref{tab:conf_densenet201}
\item Table~\ref{tab:conf_densenet2011}
\item Table~\ref{tab:conf_resnet50v2}
\item Table~\ref{tab:conf_resnet152v2}
\item Table~\ref{tab:conf_resnet50v22}
\item Table~\ref{tab:conf_resnet152v22}
\item Table~\ref{tab:conf_resnet152v23}
\end{itemize}
\begin{table*}
\setlength\tabcolsep{4pt}
\caption{\textcolor{red}{Confusion matrices for well-known pretrained convolutional neural networks}}
\label{tab:conf_resnet}
\hfill%
\subfloat[DenseNet 121]{%
\label{tab:conf_densenet121}%
\begin{tabular}{ccccc}
& & \multicolumn{3}{c}{Predicted} \\
& \multicolumn{1}{c|}{} & \multicolumn{1}{c|}{K} & \multicolumn{1}{c|}{C} & R \\ \cline{2-5}
\multirow{3}{*}{\rotatebox[origin=c]{90}{Actual}} & \multicolumn{1}{c|}{K} & \multicolumn{1}{c|}{60} & \multicolumn{1}{c|}{5} & 7\\ \cline{2-5}
& \multicolumn{1}{c|}{C} & \multicolumn{1}{c|}{8} & \multicolumn{1}{c|}{82} & 6\\ \cline{2-5}
& \multicolumn{1}{c|}{R} & \multicolumn{1}{c|}{6} & \multicolumn{1}{c|}{3} & 99
\end{tabular}}
\hfill%
\subfloat[DenseNet 201]{%
\label{tab:conf_densenet201}%
\begin{tabular}{ccccc}
& & \multicolumn{3}{c}{Predicted} \\
& \multicolumn{1}{c|}{} & \multicolumn{1}{c|}{K} & \multicolumn{1}{c|}{C} & R \\ \cline{2-5}
\multirow{3}{*}{\rotatebox[origin=c]{90}{Actual}} & \multicolumn{1}{c|}{K} & \multicolumn{1}{c|}{65} & \multicolumn{1}{c|}{2} & 5\\ \cline{2-5}
& \multicolumn{1}{c|}{C} & \multicolumn{1}{c|}{7} & \multicolumn{1}{c|}{86} & 3\\ \cline{2-5}
& \multicolumn{1}{c|}{R} & \multicolumn{1}{c|}{4} & \multicolumn{1}{c|}{3} & 101
\end{tabular}}%
\hfill%
\subfloat[DenseNet 201]{%
\label{tab:conf_densenet2011}%
\begin{tabular}{ccccc}
& & \multicolumn{3}{c}{Predicted} \\
& \multicolumn{1}{c|}{} & \multicolumn{1}{c|}{K} & \multicolumn{1}{c|}{C} & R \\ \cline{2-5}
\multirow{3}{*}{\rotatebox[origin=c]{90}{Actual}} & \multicolumn{1}{c|}{K} & \multicolumn{1}{c|}{65} & \multicolumn{1}{c|}{2} & 5\\ \cline{2-5}
& \multicolumn{1}{c|}{C} & \multicolumn{1}{c|}{7} & \multicolumn{1}{c|}{86} & 3\\ \cline{2-5}
& \multicolumn{1}{c|}{R} & \multicolumn{1}{c|}{4} & \multicolumn{1}{c|}{3} & 101
\end{tabular}}%
\hspace{\fill}
\vspace{12pt}
\hfill%
\subfloat[ResNet50 V2]{%
\label{tab:conf_resnet50v2}
\begin{tabular}{ccccc}
& & \multicolumn{3}{c}{Predicted} \\
& \multicolumn{1}{c|}{} & \multicolumn{1}{c|}{K} & \multicolumn{1}{c|}{C} & R \\ \cline{2-5}
\multirow{3}{*}{\rotatebox[origin=c]{90}{Actual}} & \multicolumn{1}{c|}{K} & \multicolumn{1}{c|}{63} & \multicolumn{1}{c|}{4} & 5\\ \cline{2-5}
& \multicolumn{1}{c|}{C} & \multicolumn{1}{c|}{5} & \multicolumn{1}{c|}{90} & 1\\ \cline{2-5}
& \multicolumn{1}{c|}{R} & \multicolumn{1}{c|}{3} & \multicolumn{1}{c|}{4} & 101
\end{tabular}}%
\hfill%
\subfloat[ResNet152 V2]{%
\label{tab:conf_resnet152v2}
\begin{tabular}{ccccc}
& & \multicolumn{3}{c}{Predicted} \\
& \multicolumn{1}{c|}{} & \multicolumn{1}{c|}{K} & \multicolumn{1}{c|}{C} & R \\ \cline{2-5}
\multirow{3}{*}{\rotatebox[origin=c]{90}{Actual}} & \multicolumn{1}{c|}{K} & \multicolumn{1}{c|}{62} & \multicolumn{1}{c|}{6} & 4\\ \cline{2-5}
& \multicolumn{1}{c|}{C} & \multicolumn{1}{c|}{7} & \multicolumn{1}{c|}{88} & 1\\ \cline{2-5}
& \multicolumn{1}{c|}{R} & \multicolumn{1}{c|}{2} & \multicolumn{1}{c|}{4} & 102
\end{tabular}}%
\hspace{\fill}
\vspace{12pt}
\hfill%
\subfloat[ResNet50 V2]{%
\label{tab:conf_resnet50v22}
\begin{tabular}{ccccc}
& & \multicolumn{3}{c}{Predicted} \\
& \multicolumn{1}{c|}{} & \multicolumn{1}{c|}{K} & \multicolumn{1}{c|}{C} & R \\ \cline{2-5}
\multirow{3}{*}{\rotatebox[origin=c]{90}{Actual}} & \multicolumn{1}{c|}{K} & \multicolumn{1}{c|}{63} & \multicolumn{1}{c|}{4} & 5\\ \cline{2-5}
& \multicolumn{1}{c|}{C} & \multicolumn{1}{c|}{5} & \multicolumn{1}{c|}{90} & 1\\ \cline{2-5}
& \multicolumn{1}{c|}{R} & \multicolumn{1}{c|}{3} & \multicolumn{1}{c|}{4} & 101
\end{tabular}}%
\hfill%
\subfloat[ResNet152 V2]{%
\label{tab:conf_resnet152v22}
\begin{tabular}{ccccc}
& & \multicolumn{3}{c}{Predicted} \\
& \multicolumn{1}{c|}{} & \multicolumn{1}{c|}{K} & \multicolumn{1}{c|}{C} & R \\ \cline{2-5}
\multirow{3}{*}{\rotatebox[origin=c]{90}{Actual}} & \multicolumn{1}{c|}{K} & \multicolumn{1}{c|}{62} & \multicolumn{1}{c|}{6} & 4\\ \cline{2-5}
& \multicolumn{1}{c|}{C} & \multicolumn{1}{c|}{7} & \multicolumn{1}{c|}{88} & 1\\ \cline{2-5}
& \multicolumn{1}{c|}{R} & \multicolumn{1}{c|}{2} & \multicolumn{1}{c|}{4} & 102
\end{tabular}}%
\hfill%
\subfloat[ResNet152 V2]{%
\label{tab:conf_resnet152v23}
\begin{tabular}{ccccc}
& & \multicolumn{3}{c}{Predicted} \\
& \multicolumn{1}{c|}{} & \multicolumn{1}{c|}{K} & \multicolumn{1}{c|}{C} & R \\ \cline{2-5}
\multirow{3}{*}{\rotatebox[origin=c]{90}{Actual}} & \multicolumn{1}{c|}{K} & \multicolumn{1}{c|}{62} & \multicolumn{1}{c|}{6} & 4\\ \cline{2-5}
& \multicolumn{1}{c|}{C} & \multicolumn{1}{c|}{7} & \multicolumn{1}{c|}{88} & 1\\ \cline{2-5}
& \multicolumn{1}{c|}{R} & \multicolumn{1}{c|}{2} & \multicolumn{1}{c|}{4} & 102
\end{tabular}}%
\hspace{\fill}
\end{table*}
\end{document}