1

I have 6 images in png format, i want to make a 3 X 2 panel with connecting arrows as shown in the image below enter image description here

How to do this latex? Arrows can look different than the ones shown image, i also want sub-figure label as 1,2 and so on instead of standard (a), (b) and so on.

  • welcome to tex.se! what you try so far? where you stuck in your effort? – Zarko Apr 25 at 18:58
3

Welcome to TeX-SE! One out of many possible ways:

\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{figure}
\centering
\begin{tikzpicture}[lablum/.style={label=below:#1,name=img-#1},
marr/.style={line width=1mm,-latex}]
 \matrix[column sep=1cm,row sep=5mm] (mat)
 { \node[lablum=1]{\includegraphics[width=3cm]{example-image-duck}};
 & \node[lablum=2]{\includegraphics[width=3cm]{example-image-duck}};\\
 \node[lablum=4]{\includegraphics[width=3cm]{example-image-duck}};
 & \node[lablum=3]{\includegraphics[width=3cm]{example-image-duck}};\\
 \node[lablum=5]{\includegraphics[width=3cm]{example-image-duck}};
 & \node[lablum=6]{\includegraphics[width=3cm]{example-image-duck}};\\
 };
 \draw[marr] (img-1) -- (img-2);
 \draw[marr] ([xshift=1mm]img-2.south east) coordinate (aux) 
 -- (img-3.north-|aux);
 \draw[marr] (img-3) -- (img-4);
 \draw[marr] ([xshift=-1mm]img-4.south west) coordinate (aux) 
 -- (img-5.north-|aux);
 \draw[marr] (img-5) -- (img-6);
\end{tikzpicture}
\caption{A matrix of figures.}
\label{fig:pffft}
\end{figure}
\end{document}

enter image description here

For more flexible labels you may want to add one argument:

\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{figure}
\centering
\begin{tikzpicture}[lablum/.style 2 args={label=below:#1 #2,name=img-#1},
marr/.style={line width=1mm,-latex}]
 \matrix[column sep=1cm,row sep=5mm] (mat)
 { \node[lablum={1}{random}]{\includegraphics[width=3cm]{example-image-duck}};
 & \node[lablum={2}{prrrg}]{\includegraphics[width=3cm]{example-image-duck}};\\
 \node[lablum=4]{\includegraphics[width=3cm]{example-image-duck}};
 & \node[lablum=3]{\includegraphics[width=3cm]{example-image-duck}};\\
 \node[lablum=5]{\includegraphics[width=3cm]{example-image-duck}};
 & \node[lablum=6]{\includegraphics[width=3cm]{example-image-duck}};\\
 };
 \draw[marr] (img-1) -- (img-2);
 \draw[marr] ([xshift=1mm]img-2.south east) coordinate (aux) 
 -- (img-3.north-|aux);
 \draw[marr] (img-3) -- (img-4);
 \draw[marr] ([xshift=-1mm]img-4.south west) coordinate (aux) 
 -- (img-5.north-|aux);
 \draw[marr] (img-5) -- (img-6);
\end{tikzpicture}
\caption{A matrix of figures.}
\label{fig:pffft}
\end{figure}
\end{document}

enter image description here

  • thanks, when i increase the width of image from 3cm to 7cm the whole matrix get aligned more to the right and is not at center exactly, you know how to fix it? – Raghav Apr 25 at 21:02
  • @Raghav When this happens this just means that the figure becomes wider than the text width. This suggests that, if you want to have the figure that wide, you use the geometry package to increase page width. – user121799 Apr 25 at 21:06
  • How can I change labels "1,2 and 3" to "1 (some text), 2 (some text) and 3 (some text)" in your code? – Raghav Jun 2 at 19:21
  • @Raghav I added a version that does that. You can always ask a new question, which is free of charge. (That is to say, in principle I am not supposed to do such updates, and in any case you will generally get quicker replies if you ask new questions.) – user121799 Jun 2 at 19:33
  • 1
    I will keep that in mind. Thanks a ton for the help! – Raghav Jun 2 at 20:16

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.