I am not able to fix that simple plot. I think I missed something, but I can't point out what !
Could you tell me why (a)
is not at midway
of the red line ?
\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}[domain=0:4]
\draw[very thin,color=gray] (-0.1,-1.1) grid (3.9,3.9);
\draw[->] (-0.2,0) -- (4.2,0) node[right] {$x$};
\draw[->] (0,-1.2) -- (0,4.2) node[above] {$f(x)$};
\draw[color=red] plot (\x,\x) node [midway,inner sep=0] (a) {} node[right] {$f(x) =x$};
\draw[->] (4,1) node[right] {this is not required (a)} -- (a) ;
\node[circle,fill,label={above left:this should be (a)}] at (2,2) {};
\end{tikzpicture}
\end{document}
Is this a duplicate of tikz-parabola-node-position ?
f(x)=x
with the domain0:4
? Am I missing something? – Peter Grill Feb 9 '12 at 15:23(a)
that is to indicate where it should be.(a)
is in fact at the origin. It looks like theplot
option doesn't allow this kind of positioning. – Roelof Spijker Feb 9 '12 at 15:26