6

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}
Trancot
  • 397

1 Answers1

7

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}

Jake
  • 232,450