4

I have nice story to tell with pictures. There Maltese type cross which is processing and twisting at the same time. So to make it more visual in paper i need grid something like this Drawing on an image with TikZ but on the whole array of images.

How Can I draw a grid on the array of images. I have something like this, sequence of images in which something is precessing around image's locus, and want to give more visual effect to reader.

\documentclass{article}

\usepackage{graphicx}
\usepackage{subfig}
\usepackage{multirow}
\usepackage{array}
\usepackage{color}
\usepackage{tikz}
\usepackage{graphicx}
\begin{document}

\begin{figure}
\centering
\advance\leftskip-3cm
\advance\rightskip-3cm

\begin{tabular}{llll}

\hspace{5mm}\subfloat[A]{\includegraphics[trim = 10mm 10mm 70mm 20mm,clip,scale=0.15]{image1}} &
\hspace{-5mm}\subfloat[A]{\includegraphics[trim = 10mm 10mm 70mm 20mm,clip,scale=0.15]{image2}}\\
\hspace{5mm}\subfloat[A]{\includegraphics[trim = 10mm 10mm 70mm 20mm,clip,scale=0.15]{image3}} &
\hspace{-5mm}\subfloat[A]{\includegraphics[trim = 10mm 10mm 70mm 20mm,clip,scale=0.15]{image4}} \\

\end{tabular}
\caption{Time Evolution}
\end{figure}
\end{document}

3 Answers 3

4

Here's a possibility using TikZ and the code in the answers to Drawing on an image with TikZ:

\documentclass{article}
\usepackage{subfig}
\usepackage[demo]{graphicx}
\usepackage{tikz}

\begin{document}

\begin{figure}
\centering
\begin{tikzpicture}
\node[anchor=south west,inner sep=0,align=center] (image) at (0,0) {%
\subfloat[A]{\includegraphics[trim = 10mm 10mm 70mm 20mm,clip,scale=0.15]{image1}}\quad
\subfloat[A]{\includegraphics[trim = 10mm 10mm 70mm 20mm,clip,scale=0.15]{image2}}\\
\subfloat[A]{\includegraphics[trim = 10mm 10mm 70mm 20mm,clip,scale=0.15]{image3}}\quad
\subfloat[A]{\includegraphics[trim = 10mm 10mm 70mm 20mm,clip,scale=0.15]{image4}}
};
\begin{scope}[x={(image.south east)},y={(image.north west)}]
\draw[help lines,xstep=.1,ystep=.1] (0,0) grid (1,1);
\foreach \x in {0,1,...,9} { \node [anchor=north] at (\x/10,0) {0.\x}; }
\foreach \y in {0,1,...,9} { \node [anchor=east] at (0,\y/10) {0.\y}; }
\end{scope}
\end{tikzpicture}
\caption{Time Evolution}
\end{figure}

\end{document}

enter image description here

5
  • Dear users, I have nice story to tell with pictures. There Maltese type cross which is preccessing and twisting at the same time. So to make it more visual in paper i need grid something like this tex.stackexchange.com/questions/9559/… but on the whole array of images- array is typically what i have wrote. Merci
    – Davit
    May 8, 2013 at 21:32
  • @Davit please see my updated answer. May 8, 2013 at 21:44
  • Perfect answer, and nice logical style. My acknowledgments.
    – Davit
    May 8, 2013 at 21:49
  • Please see what I have written, in some cases I need individual grid on each of picture inside my figure-array. Problem is why I can't use \subfloat before \includegraphics in this case. I want to since I need caption below each image. Also I guess it should be some solution like to define new command to not write this on each element of array.
    – Davit
    May 9, 2013 at 16:06
3

enter image description here

\documentclass{article}


\usepackage{subfig}
\usepackage{multirow}
\usepackage{array}
\usepackage{color}

\usepackage[demo]{graphicx}
\begin{document}

\begin{figure}
\centering
%\advance\leftskip-3cm
%\advance\rightskip-3cm

\begin{tabular}{|c|c|}
\hline
\subfloat[A]{\includegraphics[trim = 10mm 10mm 70mm 20mm,clip,scale=0.15]{image1}} &
\subfloat[A]{\includegraphics[trim = 10mm 10mm 70mm 20mm,clip,scale=0.15]{image2}}\\
\hline
\subfloat[A]{\includegraphics[trim = 10mm 10mm 70mm 20mm,clip,scale=0.15]{image3}} &
\subfloat[A]{\includegraphics[trim = 10mm 10mm 70mm 20mm,clip,scale=0.15]{image4}} \\
\hline

\end{tabular}
\caption{Time Evolution}
\end{figure}
\end{document}

I added demo as I didn't have the images (you'll need to remove it)

I changed the tabular preamble to 2 column as you only had two columns in the body.

I removed the settings of left and right skip (which should never be set directly in LaTeX)

and I added vertical and horizontal rules.


With rules over the image:

enter image description here

\documentclass{article}


\usepackage{subfig}
\usepackage{multirow}
\usepackage{array}
\usepackage{color}

\usepackage[demo]{graphicx}
\begin{document}

\begin{figure}
\centering

\begin{tabular}[b]{cc}
\subfloat[A]{\includegraphics[trim = 10mm 10mm 70mm 20mm,clip,scale=0.15]{image1}} &
\subfloat[A]{\includegraphics[trim = 10mm 10mm 70mm 20mm,clip,scale=0.15]{image2}}\\
\subfloat[A]{\includegraphics[trim = 10mm 10mm 70mm 20mm,clip,scale=0.15]{image3}} &
\subfloat[A]{\includegraphics[trim = 10mm 10mm 70mm 20mm,clip,scale=0.15]{image4}} \\
\noalign{\null}
\end{tabular}\begin{picture}(0,0)
\color{blue}\setlength\unitlength{1mm}%
\multiput(0,0)(0,10){10}{\line(-1,0){120}}
\multiput(0,0)(-10,0){13}{\line(0,1){90}}
\end{picture}
\caption{Time Evolution}
\end{figure}
\end{document}
7
  • I apologize as a very beginner, I did not get. Is the second one separate document? I tried I get error \end{pspicture} row. And why skip should not be set, if not then how handle the position of figure. And let me express my gratitude for your answer.
    – Davit
    May 8, 2013 at 21:16
  • The pspicture code was in the other answer by bugbusters not mine, \leftskip and \rightskip are TeX primitives and if you set them by hand you will completely break latex's list and display environments which need to set several lengths in compatible ways. You just want \centering here. May 8, 2013 at 21:19
  • Sorry,then what about grid, my issue is to draw grid on my whole array.
    – Davit
    May 8, 2013 at 21:24
  • @Davit isn't that what my answer does? If not you will need to clarify your question.You have four images and it makes a 2x2 grid with each image centred in one of the squares. Or do you want a grid over your images? May 8, 2013 at 21:27
  • Monsieur Carlisle, I need grid ON images
    – Davit
    May 8, 2013 at 21:35
2

enter image description here

\documentclass[pstricks,border=12pt]{standalone}
\usepackage{graphicx}

\newsavebox\IBox
\savebox\IBox{\includegraphics{example-image-a}}

\def\row{10}
\def\col{10}
\psset
{
    xunit=\dimexpr\wd\IBox/\col,
    yunit=\dimexpr\ht\IBox/\row,
}

\addtopsstyle{gridstyle}
{
    gridcolor=cyan,
    gridlabels=0pt,
}
\begin{document}
\begin{pspicture}[showgrid=top](\numexpr\col*2,\numexpr2*\row)
    \rput[bl](0,0){\usebox\IBox}
    \rput[bl](\col,0){\includegraphics{example-image-b}}
    \rput[bl](0,\row){\includegraphics{example-image-c}}
    \rput[bl](\col,\row){\includegraphics{example-image-a}}
\end{pspicture}
\end{document}
2
  • Why I have an error on \end{pspicture} line? Merci
    – Davit
    May 8, 2013 at 21:41
  • @Davit use latex->dvips->ps2pdf or xelatex instead of pdflatex May 8, 2013 at 21:48

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.