# create a line of labels above and for each subimage (using includegraphics)

Here is my code:

\begin{figure*}
\begin{center}
\includegraphics[width=1in]{ch_f_25-eps-converted-to.pdf}\includegraphics[width=1in]{ch_f_30-eps-converted-to.pdf}\includegraphics[width=1in]{ch_f_35-eps-converted-to.pdf}

\includegraphics[width=1in]{ch_o_25-eps-converted-to.pdf}\includegraphics[width=1in]{ch_o_30-eps-converted-to.pdf}\includegraphics[width=1in]{ch_o_35-eps-converted-to.pdf}

\includegraphics[width=1in]{ch_s_25-eps-converted-to.pdf}\includegraphics[width=1in]{ch_s_30-eps-converted-to.pdf}\includegraphics[width=1in]{ch_s_35-eps-converted-to.pdf}

\includegraphics[width=1in]{c25-eps-converted-to.pdf}\includegraphics[width=1in]{c30-eps-converted-to.pdf}\includegraphics[width=1in]{c35-eps-converted-to.pdf}

\includegraphics[width=1in]{smf_ch25-eps-converted-to.pdf}\includegraphics[width=1in]{smf_ch30-eps-converted-to.pdf}\includegraphics[width=1in]{smf_ch35-eps-converted-to.pdf}

\includegraphics[width=1in]{gtr_ch_25.eps}\includegraphics[width=1in]{gtr_ch_30.eps}\includegraphics[width=1in]{gtr_ch_35.eps}\includegraphics[width=1in]{gtr_ch_40.eps}

\end{center}
\end{figure*}


So I have 6 rows and each row has three subfigures. So my question is how can I code in order to add the notes above each row and column to have something like this:

    25     30     35
a   x      x      x
b   x      x      x
c   x      x      x
d   x      x      x
e   x      x      x
f   x      x      x


The above is not codes but the form that I want, where the "x" are subfigures. So I want to add the "20", "25", "30" and "a" to "f" as labels to make it like a table besides the subfigures.

How can I achieve this? Thanks in advance.

You could simply put everything in a tabular.

I've used the graphbox package to easily manage the vertical alignment.

Remember to use \centering instead of a center environment within a figure one.

\documentclass{article} % always post a complete mwe!
\renewcommand*{\arraystretch}{5}
\usepackage{graphbox} % it loads the graphicx package
\newcommand*{\myinclude}[1]{\includegraphics[width=1in, align=c]{#1}}% I've defined a new command for convenience

\begin{document}
\begin{figure*}
\centering % use centering instead of center environment
\begin{tabular}{*4c}
& 25 & 30 & 35 \\[-4ex]% vertical adjustment of the first line to compensate \arraystretch
a & \myinclude{example-image-a.pdf} &
\myinclude{example-image-a.pdf} &
\myinclude{example-image-a.pdf} \\% since we don't have your images I've use the samples provided by graphicx package
b & \myinclude{example-image-a.pdf} &
\myinclude{example-image-a.pdf} &
\myinclude{example-image-a.pdf} \\
c & \myinclude{example-image-a.pdf} &
\myinclude{example-image-a.pdf} &
\myinclude{example-image-a.pdf} \\
d & \myinclude{example-image-a.pdf} &
\myinclude{example-image-a.pdf} &
\myinclude{example-image-a.pdf} \\
e & \myinclude{example-image-a.pdf} &
\myinclude{example-image-a.pdf} &
\myinclude{example-image-a.pdf} \\
f & \myinclude{example-image-a.pdf} &
\myinclude{example-image-a.pdf} &
\myinclude{example-image-a.pdf} \\
\end{tabular}
\end{figure*}
\end{document}


Edit:

If you don't want any space among the images, it is sufficient to comment \renewcommand*{\arraystretch}{5} and to put {c*3{c@{}}} in the column definition.

\documentclass{article}
%\renewcommand*{\arraystretch}{5} % to change the vertical space
%\setlength{\tabcolsep}{10pt} % to set space between columns
\usepackage{graphbox} % it loads the graphicx package
\newcommand*{\myinclude}[1]{\includegraphics[width=1in, align=c]{#1}}% I've defined a new command for convenience

\begin{document}
\begin{figure*}
\centering % use centering instead of center environment
%\begin{tabular}{*4c}
\begin{tabular}{c*3{c@{}}}
& 25 & 30 & 35 \\[1.5ex]% vertical adjustment of the first line to compensate \arraystretch
a & \myinclude{example-image-a.pdf} &
\myinclude{example-image-a.pdf} &
\myinclude{example-image-a.pdf} \\% since we don't have your images I've use the samples provided by graphicx package
b & \myinclude{example-image-a.pdf} &
\myinclude{example-image-a.pdf} &
\myinclude{example-image-a.pdf} \\
c & \myinclude{example-image-a.pdf} &
\myinclude{example-image-a.pdf} &
\myinclude{example-image-a.pdf} \\
d & \myinclude{example-image-a.pdf} &
\myinclude{example-image-a.pdf} &
\myinclude{example-image-a.pdf} \\
e & \myinclude{example-image-a.pdf} &
\myinclude{example-image-a.pdf} &
\myinclude{example-image-a.pdf} \\
f & \myinclude{example-image-a.pdf} &
\myinclude{example-image-a.pdf} &
\myinclude{example-image-a.pdf} \\
\end{tabular}
\end{figure*}
\end{document}


If you want to change to space vertically uncomment \renewcommand*{\arraystretch}{...} and put in it the desidered height.

If you want to change to space horizontally uncomment \setlength{\tabcolsep}{...}, put in it the desidered width, and leave out @{} from the column definition (that is use \begin{tabular}{*4c} instead of \begin{tabular}{c*3{c@{}}}).

• Thanks! Another question: How can I adjust the distance between each image and the label. Actually I want a smaller distance between two adjacent images in two rows and columns, therefore the size of each image. That's like the format of the table. – Ian Mar 10 '17 at 9:07
• I'm not sure for the horizontal alignment, I change c to m, and then what...? Thank you so much! – Ian Mar 10 '17 at 9:39