I'm trying to use TikZ to combine four raster images into a single figure and annotate the images. If you feel like asking why, see *.
My first problem is arranging / aligning the images in a grid.
The code below sort of gets the job done, but the order in which the images appear is not what I would expect. I would expect
[a][b]
[c][d]
% remember usepackage{tikz}
\begin{figure}
\begin{tikzpicture}
\node[anchor=north west ,inner sep=0] (frame1) at (0,0)
{\includegraphics[width=0.45\textwidth]{a.png}};
\node[anchor=north east,inner sep=0] (frame2) at (0,0)
{\includegraphics[width=0.45\textwidth]{b.png}};
\node[anchor=south west,inner sep=0] (frame3) at (0,0)
{\includegraphics[width=0.45\textwidth]{c.png}};
\node[anchor=south east,inner sep=0] (frame4) at (0,0)
{\includegraphics[width=0.45\textwidth]{d.png}};
\end{tikzpicture}
\caption{My caption}
\end{figure}
How would you arrange these four images in a 2x2 grid, preferably in a predictable order?
*Scientific journals often expect a single pdf or tiff file for each figure, combining images with the subfigure environment or similar is not an option since they do not support exporting the figure you created to a seperate pdf file, but TikZ does. And I need this single pdf file to submit as the final figure. Combining and annotating in an external graphics editor like Inkscape introduces the problem of fonts, font sizes etc. Much nicer to have LaTeX do the annotation to get the right font and size.
achor=north west
it means that the image (a) will have its upper left corner at position 0.0. For (b) the same would be its top right corner. So you see that if you just change the anchors, it will work. But for a bigger grid, your solution wouldn't work. you could use atabular
. why can't you use asubfigure
orsubfig
?