# Node placement problem

This is my first question in tex.stackexchange. It might be relatively simple problem but I am having difficulties with the placement of the nodes inside graphics.

The problem is that when I try to compile the code below I get the result which has problem.

\documentclass{standalone}
\usepackage{pgfplots}

\begin{document}

\begin{tikzpicture}
\begin{axis}[thick,ticks=none,domain=-pi:pi,samples=1000,axis x line=middle,axis y line=none,xlabel={t},xmin=-4,xmax=7,ymax=2,ymin=-2]
\addplot[smooth, color=black] (\x,{sin((9*(deg(x))) )*cos(((deg(x))) )}) node[pos=0.75,pin={carrier wave},thick,inner sep=0pt] {};
\addplot[smooth, color=black] (\x,{cos(((deg(x))) )}) ;
\addplot[smooth, color=black] (\x,{-cos(((deg(x))) )}) node[pos=0.75,pin={envelope wave},thick,inner sep=0pt] {};
\end{axis}
\end{tikzpicture}

\end{document}


It should look like this (look at the position of the pinned text):

Once it was working but now it is not working.

• sorry, what do you want to achieve? Apr 3, 2013 at 10:18
• Your code compiles without mishap on my machine. What is your question, exactly? "Once it was working but now it is not working" does not give us much information. Apr 3, 2013 at 10:21
• Welcome to TeX.SX. It is better to turn your code snippet into a MWE starting with \documentclass ending with \end{document} and including only the necessary packages that reproduce the problem. This will help who wants to answer you. :) Apr 3, 2013 at 10:30
• you can look at this link i45.tinypic.com/wgyus5.png to see the problem I think, I have a compiler options problem. Apr 3, 2013 at 10:42
• So the problem is that the arrow and carrier wave is not in the correct location? It's important to provide an MWE as @ClaudioFiandrino stated, otherwise we can't determine which options might be interfering with your image. Apr 3, 2013 at 10:47

Try this (I just fixed the positions and angles for the pins):

\documentclass{article}
\usepackage{pgfplots}

\begin{document}

\begin{tikzpicture}
\begin{axis}[thick,ticks=none,domain=-pi:pi,samples=1000,axis x line=middle,axis y line=none,xlabel={t},xmin=-4,xmax=7,ymax=2,ymin=-2]
\addplot[smooth, color=black] (\x,{sin((9*(deg(x))) )*cos(((deg(x))) )}) node[pos=0.93,pin={[pin distance=1cm]75:carrier wave},thick,inner sep=0pt] {};
\addplot[smooth, color=black] (\x,{cos(((deg(x))) )}) ;
\addplot[smooth, color=black] (\x,{-cos(((deg(x))) )}) node[pos=0.5,pin={290:envelope wave},thick,inner sep=0pt] {};
\end{axis}
\end{tikzpicture}

\end{document}


• Another option would be to use coordinates instead of nodes and use something like shorten <=\pgflinewidth for the pin edge if one wants to preserve the little space that the node occupies. Apr 3, 2013 at 18:04