# Labeling a point using TikZ

In the following code, I want to label the point (1,1) as "P." (It is not exciting, I know. It is part of a graph that I want to draw.) I have the code \node[above right, outer sep=2pt] (1,1) {P}; to do this. TikZ is putting the label above and to the right of the origin.

Why isn't TikZ putting the label above and to the right of (1,1)?

I have a grid placed on the Cartesian plane. With outer sep=2pt, I expected that some of the grid would be obscured by the label P. I want the letter "P" to stand out on the graph, and I think it would if some of the grid lines were obscured.

\documentclass{amsart}
\usepackage{tikz}
\usetikzlibrary{shapes,positioning,intersections,quotes}

\begin{document}

\begin{tikzpicture}
\draw[yellow] (-1.25,-1.25) grid[xstep=0.5, ystep=0.5]  (2.25,2.25);
\draw[draw=gray!30,latex-latex] (0,2) +(0,0.5cm) node[above right] {$y$} -- (0,-1) -- +(0,-0.5cm);
\draw[draw=gray!30,latex-latex] (-1,0) +(-0.5cm,0) -- (2,0) -- +(0.5cm,0) node[below right] {$x$};
\node[above right, outer sep=2pt] (1,1) {P};
\end{tikzpicture}

\end{document}

• Have you tried adding e.g. fill=white to the node to obscure what's behind it?
– cfr
Apr 19, 2015 at 20:52
• @cfr Now I did. Thanks. (I also added the option "circle.") Apr 19, 2015 at 20:57

You can obscure the grid lines behind the node using fill=white. You can also do this if you use a pin which will draw a line from the point to the label. Or you could use the label option which is similar but without the line.

\documentclass[tikz,border=5pt]{standalone}

\usetikzlibrary{shapes,positioning,intersections,quotes}

\begin{document}

\begin{tikzpicture}
\draw[yellow] (-1.25,-1.25) grid[xstep=0.5, ystep=0.5]  (2.25,2.25);
\draw[draw=gray!30,latex-latex] (0,2) +(0,0.5cm) node[above right] {$y$} -- (0,-1) -- +(0,-0.5cm);
\draw[draw=gray!30,latex-latex] (-1,0) +(-0.5cm,0) -- (2,0) -- +(0.5cm,0) node[below right] {$x$};
\node [fill, draw, circle, minimum width=3pt, inner sep=0pt, pin={[fill=white, outer sep=2pt]135:P}] at (.5,1) {};
\node[above right=10pt of {(1,1)}, outer sep=2pt,fill=white] {P};
\end{tikzpicture}

\end{document}


• Thanks for illustrating label and pin. I will refer to the manual for these options. I want to get the "P" above and to the right of the point (1,1). Apr 19, 2015 at 21:01
• I am still not able to move the "P" to the appropriate position. Why doesn't \node[above right, outer sep=2pt] (1,1) {P}; do it? Apr 19, 2015 at 21:32
• @user74973 Have you tried \node[...] at (1,1) {P};? Apr 19, 2015 at 22:53
• @user74973: You are missing at before (1,1).
– user11232
Apr 19, 2015 at 22:55
• @user74973 Use label={[fill=white,text=green!20!white]left:$P$}
– user11232
Apr 20, 2015 at 15:18