I want to plot some graphs in pgfplots and want to place nodes on the exact same x coordinate of the plot. The position of the note has to be set in x direction but free in y direction. Here is one example of the way it shouldn't be.
\documentclass{article}
\usepackage{pgfplots}
\begin{document}
\begin{figure}
\begin{tikzpicture}
\begin{axis}
\addplot {-x} [yshift=8pt] node[pos=0.1] {$0,1$};
\addplot {x^2} [yshift=8pt] node[pos=0.1] {$0,1$};
\addplot{3*x^2}[yshift=8pt] node[pos=0.1] {$0,1$};
\end{axis}
\end{tikzpicture}
\end{figure}
\end{document}
With the example linked by Jake I adapted the file. Now it is producing the return value 1 and no good result. What is wrong?
\documentclass{article}
\usepackage{pgfplots}
\begin{document}
\begin{figure}
\begin{tikzpicture}
\begin{axis}
\addplot[yshift=8pt,add node at x={-4}{$0,1$}] {-x};
\addplot[yshift=8pt,add node at x={-4}{$0,1$}] {x^2};
\addplot[yshift=8pt,add node at x={-4}{$0,1$}] {3*x^2};
\end{axis}
\end{tikzpicture}
\end{figure}
\end{document}
(axis cs:x,y)
to use the axis coordinate system to place your nodes.\addplot
via something like\node at (axis cs: 0,20) {$f(x)$};
which places the node at(0,20)
, for example.