# How to frame a pdf image with a coordinate system (Tikz?)

I would like to know whether it is possible to put a frame around an included image (via \includegraphics).

I would like to add a coordinate system to an image.

-
Take a look at Drawing on an Image with TikZ and How to superimpose LaTeX on a picture?. Those questions might help you get started. If you get stuck, you can edit your question to add more information. –  Jake Jul 7 '12 at 11:12
There are many coordinate systems. Hopefully the system you need is Cartesian coordinate system. –  kiss my armpit Jul 7 '12 at 18:08

\documentclass{article}
\usepackage{overpic}
\begin{document}

\begin{overpic}[grid, scale=0.5]{tiger.pdf}
\end{overpic}

\end{document}


-

Howdy please take a look at the following code

\documentclass{book}

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

%Define grid size type=int
\def\gmin{-2}
\def\gmax{2}

\begin{tikzpicture}
% include a graphic with border
% strip {\color{blue}} its there for a showcase purpose only
\node[draw, line width=10pt, red, inner sep=0pt, anchor=center] at (0,0) {{\color{blue}\includegraphics[width=100pt, height=100pt]{demo}}};
% now the manually drawn grid. It uses the  variables from above.
\foreach \x in {\gmin,...,\gmax} \draw (\x ,\gmin) -- (\x ,\gmax) node[anchor=south] {$\x$};
\foreach \y in {\gmin,...,\gmax} \draw (\gmin,\y) -- (\gmax,\y) node[anchor=west] {$\y$};

\end{tikzpicture}

\end{document}


This answers both of your questions. Remarks: there are many possible ways to achieve something like that. If you prefer another way please follow the links @Jake gave you.

For putting a frame around something there are many packages around (most of them have "frame" in their name). A defulat method (build into LaTeX2e) is using fbox \fbox{\includegraphics[width=100pt, height=100pt]{demo}} .

-

## Case 1 (using 4 quadrants)

% please "TeXify" it with xelatex because
% it imports a PDF image which is explicitly specified by .pdf extension.

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

\def\M{3}% the number of columns
\def\N{3}% the number of rows
\def\filename{example-image-a.pdf}% filename of the imported image
\def\scale{1}% scalling factor

\newsavebox\IBox
\savebox\IBox{\includegraphics[scale=\scale]{\filename}}

\psset
{
xunit=0.5\dimexpr\wd\IBox/\M\relax,
yunit=0.5\dimexpr\ht\IBox/\N\relax,
}

\begin{document}
\begin{pspicture}(-\M,-\N)(\M,\N)
\rput(0,0){\usebox\IBox}
\psgrid
\end{pspicture}
\end{document}


## Case 2 (only using the first quadrant)

% please "TeXify" it with xelatex because
% it imports a PDF image which is explicitly specified by .pdf extension.

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

\def\M{3}% the number of columns
\def\N{3}% the number of rows
\def\filename{example-image-a.pdf}% filename of the imported image
\def\scale{1}% scalling factor

\newsavebox\IBox
\savebox\IBox{\includegraphics[scale=\scale]{\filename}}

\psset
{
xunit=\dimexpr\wd\IBox/\M\relax,
yunit=\dimexpr\ht\IBox/\N\relax,
}

\begin{document}
\begin{pspicture}(\M,\N)
\rput[bl](0,0){\usebox\IBox}
\psgrid
\end{pspicture}
\end{document}

-
There are 4 possible ways to put the axis labels. Let me know if you need such a feature! –  kiss my armpit Jul 7 '12 at 16:48
The grid style can be also be customized. Let me know if you need to customize it. –  kiss my armpit Jul 7 '12 at 16:55