Add caption to figure in multicolumn

captionsgraphicsincludeincludegraphicssubcaption

I need to add a caption to three images placed as follow:
enter image description here

I did it by adding the caption command as you can see in the following snippet, but it doesn't work:

\begin{figure*}[ht]
\begin{center}
$\begin{array}{rl}
    \includegraphics[width=0.45\textwidth]{images/chapter4/img_1.png}\caption{Training set} &
    \includegraphics[width=0.45\textwidth]{images/chapter4/img_2.png}\caption{Validation set}\\
    \multicolumn{2}{c}{\includegraphics[width=0.45\textwidth]{images/chapter4/img_3.png.png}\caption{Test set}}
\end{array}$
\caption{Overall caption.}
\end{center}
\end{figure*}

I only see the overall caption, but I also need a caption under each image.

Best Answer

It is best to use subfigures:

b

\documentclass[12pt,a4paper]{article}

\usepackage{graphicx}

\usepackage[position=top]{subfig}% needed <<<<<<<<<<

\begin{document}
    
     \begin{figure*}[hp!]
        \centering
        \subfloat[Training set]{%       
            \includegraphics[width=0.45\textwidth]{example-image}
        }\hfill        
        \subfloat[Validation set]{%
            \includegraphics[width=0.45\textwidth]{example-image}
        }\\         
        \subfloat[Test set]{%
            \includegraphics[width=0.45\textwidth]{example-image}               
        }
        \caption{Overall caption.}
        \label{fig:images}
    \end{figure*} 

    See the used sets  in the figure \ref{fig:images}.

        
\end{document}
Related Question