# How to connect images with arrows in Latex?

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

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 '19 at 18:58

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}


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}


• 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 '19 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 '19 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 '19 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 '19 at 19:33
• I will keep that in mind. Thanks a ton for the help! – Raghav Jun 2 '19 at 20:16