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.

This question is slightly different from Drawing on an image with TikZ.

What I'm asking is how can I put a vertex label, at a particular point (x,y), on an image of a graph in TikZ?

\begin{center}
\begin{tikzpicture}
    \node[anchor=south west,inner sep=0 <--What is this?] at (0,0) {\includegraphics[scale=.5]{graph.png}};
    \node[???]{$v_1$};
\end{tikzpicture}
\end{center}
share|improve this question
    
I assume you mean Drawing on an image with TikZ‌​? The approach there can be used to place arbitrary objects on an image, not only for red rectangles on mushrooms. –  Jake Aug 2 '13 at 19:56
    
Yes, but I don't know how to draw a label. –  Trancot Aug 2 '13 at 19:57
    
Is it just a node? –  Trancot Aug 2 '13 at 19:58
    
I think I figured it out: \node[shift={(1.0,0.3)}]{$v_1$}; –  Trancot Aug 2 '13 at 20:09

1 Answer 1

You can place anything using this approach, not just rectangles.

To place text, you have to use \node at (<coordinates>) {<text>};:

\documentclass{article}
\usepackage{tikz}

\begin{document}
\begin{tikzpicture}
    \node[anchor=south west,inner sep=0] (image) at (0,0) {\includegraphics[width=0.9\textwidth]{mushrooms.jpg}};
    \begin{scope}[
        x={(image.south east)},
        y={(image.north west)}
    ]
        \node [white, font=\bfseries] at (0.25,0.65) {$P(X|Y)$};
    \end{scope}
\end{tikzpicture}
\end{document}

share|improve this answer

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.