Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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.

share|improve this question
3  
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. –  Oh my ghost Jul 7 '12 at 18:08

3 Answers 3

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

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

\end{document}

enter image description here

share|improve this answer

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}

resulting image

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}} .

share|improve this answer

Please read the given comments.

Case 1 (using 4 quadrants)

enter image description here

% 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)

enter image description here

% 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}
share|improve this answer
    
There are 4 possible ways to put the axis labels. Let me know if you need such a feature! –  Oh my ghost Jul 7 '12 at 16:48
    
The grid style can be also be customized. Let me know if you need to customize it. –  Oh my ghost Jul 7 '12 at 16:55

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.