TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I need to arrange my pictures on the way shown in the attached figure. Please any help from you.

enter image description here

share|improve this question
Could you be a bit more precise, please. It is unclear if you also need the labels on the top and on the left. – Stefan Pinnow Feb 15 at 20:25
Hi Stefan Pinnow, In fact I have 9 pictures arranged in a 3 columns and 3 rows. Each column contains the evolution in time of the simulation picture on focus. for exemple column 1, we have the evolution of N agents from time t=0 to time t=200. The same as for the other columns. So, I want it exactly like I clarified it on the picture. – khaldi Feb 15 at 20:38
Hi Stefan, Yes I need the labels both on the top and on the left. But the top labels are for columns and the left labels are for rows. There is no label for each picture. I need a one caption for the entire arrangement. – khaldi Feb 15 at 20:44
It may be a duplicate, but surely not of the linked question. – egreg Feb 15 at 21:06
up vote 6 down vote accepted

This can be achieved for example with the tikz package and the matrix library. Here is a dummy picture showing a similar thing as in your question with the corresponding result.

% works with tikz v3.0.1a
    % define size of rectangular pictures
            minimum size=\Size,
            inner sep=0pt,
            % this is just to show something
            % comment the two following lines or adjust them accordingly
        \matrix [
            % typeset nodes in math mode
            matrix of math nodes,
            % use a smaller font for the nodes
            node font=\scriptsize,
            % rotate all nodes in the first column
            column 1/.append style={
                every node/.append style={
            % set the separations of the columns and rows
            row sep=2.5mm,
            column sep=2.5mm,
        ] {
                    &[-2ex] N = 150 & N = 200 & N = 250 \\[-2ex]
            t = 0   & \node [Pic] {};
                        & \node [Pic] {};
                            & \node [Pic] {}; \\
            t = 100 & \node [Pic] {};
                        & \node [Pic] {};
                            & \node [Pic] {}; \\
            t = 200 & \node [Pic] {};
                        & \node [Pic] {};
                            & \node [Pic] {}; \\
%    \caption{Just a dummy caption}
%        \label{fig:dummy}

image showing the result of above code

Now you simply have to replace the \node [Pic] {};s with node [Pic] {\includegraphics[width=\Size]{<pic name>}}; where <pic name> is the corresponding picture name which can be found by the graphicx package. Hopefully my comments in the code are sufficient that you can modify sizes and distances on your own.

Please note that the standalone documentclass does not provide a figure environment, why I have commented these lines of code.

share|improve this answer
thanks very much for your helps, the both solutions have been successfully given me what I am willing to do. This gained me much time. – khaldi Feb 16 at 19:16
@khaldi, you are welcome. Two more small comments: I would also add a unit to time, so that it is clear if 200 is in seconds, minutes or years. If you don't know the siunitx package yet, give it a try and state it, e.g. as \SI{200}{\second}. Please accept one of the solutions as an answer, so it is clear that a solution is given that fits your needs. Should there be any new solution in the future that will be better than the already chosen one you are free to change the accepted answer at any time. – Stefan Pinnow Feb 16 at 19:22
Oh Stefan, that is also a great improvement. thanks for your interest. I am so sorry for replying late to your comment. – khaldi Feb 27 at 13:17
@khaldi, not a problem; better late than never ;) – Stefan Pinnow Feb 27 at 14:09
Hi Stefan, I would ask you about how to precise both width and height and not the size in the line \pgfmathsetlengthmacro{\Size}{25mm}. because I noticed that this gives me a square container in witch the pictures will be included. – khaldi Feb 29 at 14:44

See, if this is what you looking for:


    &   $N=150$ &   $N=150$ &   $N=250$                             \\
            &   \includegraphics[width=\linewidth]{example-image-a}
        &   \includegraphics[width=\linewidth]{example-image-b}
            &   \includegraphics[width=\linewidth]{example-image-c}   \\
            &   \includegraphics[width=\linewidth]{example-image-a}
        &   \includegraphics[width=\linewidth]{example-image-b}
            &   \includegraphics[width=\linewidth]{example-image-c}   \\
            &   \includegraphics[width=\linewidth]{example-image-a}
        &   \includegraphics[width=\linewidth]{example-image-b}
            &   \includegraphics[width=\linewidth]{example-image-c}   \\

enter image description here

share|improve this answer
thanks very much for your reply, this saved my time. thanks in advance. Both solutions have been tested and the both have given me what I am seeking to reach. – khaldi Feb 16 at 19:18

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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