# tikz - command node - text

my MWE is:

\documentclass{book}
\usepackage{tikz}
\usetikzlibrary{intersections}
\usetikzlibrary{calc}

\begin{document}
\begin{tikzpicture}[domain=0:2*pi]
\draw[xstep=pi/4, ystep=0.5, dashed, color=gray] (-0.1,-1.6) grid (2*pi,1.6);
\draw[->] (-0.2,0) -- (7,0) node[right] {$t$};
\draw[->] (0,-2) -- (0,2) node[above] {$i(t)$};
\node[below left](0,0){$0$};
\draw[color=blue, smooth]   plot (\x,{sin(\x r)})    node[below right] {$i(t)$};
\node[below left] at (2,2) {$i(t) = I_0\sin\omega t$};
\end{tikzpicture}
\end{document}


In the last command I try to put the text $i(t) = I_0\sin\omega t$ at coordinate (2,2), but the result does not match my expectations. Where is problem? How to insert text at a certain position without depending on previous commands?

I got this image:

I expected that the text $i(t) = I_0\sin\omega t$ will be more right.

-
What are your expectations? For me, the node is placed correctly below left of the coordinate (2,2). Where do you expect it to appear? –  Jake Sep 10 '12 at 8:08
I added a picture. Yours is the same? –  jafan Sep 10 '12 at 8:55
Yes: it is exactly the same. Where do you want to place $i(t) = I_0\sin\omega t$? –  Claudio Fiandrino Sep 10 '12 at 8:58
I also got the same picture. I added \fill (2,2) circle[radius=2pt]; to check where the point (2,2) is and the text is placed "below left" of that point. Perhaps that point isn't where you expected it to be. –  Loop Space Sep 10 '12 at 9:01

If you want it to be more right, then you should specify below right and not below left:

\documentclass{book}
\usepackage{tikz}
\usetikzlibrary{intersections}
\usetikzlibrary{calc}

\begin{document}
\begin{tikzpicture}[domain=0:2*pi]
\draw[xstep=pi/4, ystep=0.5, dashed, color=gray] (-0.1,-1.6) grid (2*pi,1.6);
\draw[->] (-0.2,0) -- (7,0) node[right] {$t$};
\draw[->] (0,-2) -- (0,2) node[above] {$i(t)$};
\node[below left](0,0){$0$};
\draw[color=blue, smooth]   plot (\x,{sin(\x r)})    node[below right] {$i(t)$};
\node[below right] at (2,2) {$i(t) = I_0\sin\omega t$};
\end{tikzpicture}
\end{document}


You can find more information on positioning nodes in the pgfmanual, section 16.5.

-
Or perhaps just below, or perhaps nothing at all (depending on how we should interpret "more right"; personally, I'd put nothing at all as I think it should be a bit higher than it is). –  Loop Space Sep 10 '12 at 9:19
@AndrewStacey: yeah, it sure depends on the requirements – I can only guess what they are supposed to be. –  knittl Sep 10 '12 at 9:38
From the checkmark it appears that you guessed correctly! Probably worth directing the questioner to Section 16.5 of the PGF manual (version 2.10 - might be elsewhere in different versions) on positioning nodes using anchors. –  Loop Space Sep 10 '12 at 9:45