0

enter image description hereI had difficulty doing caption for the following set of images. I have done several codes and I was able to have the caption by doing "subfloat", however, with subfloat it was hard for me to do the vertical and horizontal lables. Someone suggested I use the following code to lable the images vertically and horizontally but the code he gave me was using "tabular' , how can I insert caption in the following code. Also, how can I put the labels on left at the center of the images. update: I added a picture in which the figure still needs to be extended vertically to fill a whole page. The code below produces the figure on left (page 48) while another code produced the one on right. Both of them do not extend the figure vertically to get red of the extra space seen on top and at the bottom of the page and thus,both of them did not satisfy my needs yet.

thanks!enter image description here

\begin{center}
    \begin{tabular}{cccc}
        &\multicolumn{3}{c}{\adjustimage{width=.94\textwidth}{phasebar.eps}}\\
        &\begin{adjustbox}{max width=.28\textwidth}
            w=10nm
        \end{adjustbox}&
        \begin{adjustbox}{max width=.28\textwidth}
            w=40nm
        \end{adjustbox}&
        \begin{adjustbox}{max width=.28\textwidth}
            w=100nm
        \end{adjustbox}\\
        \begin{sideways} t=10nm \end{sideways}&
        \adjustimage{width=.29\textwidth}{phase10t10w125x300y}&
        \adjustimage{width=.29\textwidth}{phase10t40w250x400y}&
        \adjustimage{width=.29\textwidth}{phase10t100w340x500y}\\
        \begin{sideways} t=30nm \end{sideways}&
        \adjustimage{width=.29\textwidth}{phase30t10w200x400y}&
        \adjustimage{width=.29\textwidth}{phase30t40w350x750y}&
        \adjustimage{width=.29\textwidth}{phase30t100w550x1200y}\\
        \begin{sideways} t=50nm \end{sideways}&
        \adjustimage{width=.29\textwidth}{phase50t10w300x600y}&
        \adjustimage{width=.29\textwidth}{phase50t40w600x1100y}&
        \adjustimage{width=.29\textwidth}{phase50t100w600x1500y}\\

    \end{tabular}
\end{center}
  • 2
    Please edit your code to make it compilable. We should be able to cut, paste and hit compile to reproduce what you are seeing. That means you also need to replace images with ones we all have (e.g. from the mwe package). Or you can specify their dimensions and pass graphicx the demo option to replace them with black boxes. – cfr Nov 16 '14 at 2:42
  • In your adjustbox environments, you should write 10\,nm, 40\,nm, and so on. Even better, typeset units with the siunitx package. – user10274 Nov 17 '14 at 13:47
3

To align them you need valign=c and enclose the entire tabular inside figure environment.

\documentclass[demo]{article}
\usepackage{adjustbox,showframe}            %% remove showframe in your document
\usepackage[detect-all]{siunitx}
\usepackage{array}
\newcolumntype{C}[1]{>{\centering\arraybackslash}p{#1}}
\begin{document}
  \begin{figure}
   \centering
    \begin{tabular}{C{0.03\textwidth}*{3}{C{\dimexpr0.31\textwidth-2\tabcolsep\relax}}}
        &\multicolumn{3}{C{\dimexpr0.97\textwidth-4\tabcolsep\relax}}{\adjustimage{width=\linewidth}{phasebar.eps}}\\
        &   $w=\SI{10}{\nano\meter}$
        &   $w=\SI{40}{\nano\meter}$
        &   $w=\SI{100}{\nano\meter}$\\
        \begin{adjustbox}{rotate=90,valign=c}
           $t=\SI{10}{\nano\meter}$
        \end{adjustbox}&
        \adjustimage{width=\linewidth,valign=c}{phase10t10w125x300y}&
        \adjustimage{width=\linewidth,valign=c}{phase10t40w250x400y}&
        \adjustimage{width=\linewidth,valign=c}{phase10t100w340x500y}\\[10mm]
        \begin{adjustbox}{rotate=90,valign=c}
         $t=\SI{30}{\nano\meter}$
        \end{adjustbox}&
        \adjustimage{width=\linewidth,valign=c}{phase30t10w200x400y}&
        \adjustimage{width=\linewidth,valign=c}{phase30t40w350x750y}&
        \adjustimage{width=\linewidth,valign=c}{phase30t100w550x1200y}\\[10mm]
        \begin{adjustbox}{rotate=90,valign=c}
         $t=\SI{50}{\nano\meter}$
        \end{adjustbox}&
        \adjustimage{width=\linewidth,valign=c}{phase50t10w300x600y}&
        \adjustimage{width=\linewidth,valign=c}{phase50t40w600x1100y}&
        \adjustimage{width=\linewidth,valign=c}{phase50t100w600x1500y}\\
    \end{tabular}
   \caption{This is my one big figure\label{fig:somefig}}
\end{figure}
\end{document}

enter image description here

  • Hi Harish, thanks for the help. Actually, I needed to do a caption for the whole thing( all pictures together). I do not want to name each single picture. I only want to keep the three (w) and three (t) but want to replace the captions a,b,c,d,e,f,g,h,i,j with only one caption for the whole thing. – Naema Nov 16 '14 at 22:40
  • @Naema Please see the edit. I have also used siunitx for the units and adjust 10mm suitably. – user11232 Nov 16 '14 at 23:16
  • thanks Harish, that is exactly what i wanted. I am wondering if I can stretch the figure somehow to let it fill a whole page instead of half, what should I change in the code to get the figure stretched vertically?. – Naema Nov 17 '14 at 0:52
  • @Naema See the update. You may adjust the dimensions in the argument of C – user11232 Nov 17 '14 at 4:16
  • Harish, the last update you did worked but caused my thesis to be all bounded including this figure . Is there a way to let such a figure fill a whole page without having those boundaries around? – Naema Nov 24 '14 at 20:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.