I need to plot f(x) = 1 / x in LaTeX and am trying to with Tikz. I haven't found a way to set the vertical range, so the values go out of bound around x=0.
Using gnuplot directly doesn't seem to be an option because the fix presented here fails.
\begin{frame}
\begin{tikzpicture}
\draw[->] (-10, 0) -- (10, 0) node[right] {$x$};
\draw[->] (0, -10) -- (0, 10) node[above] {$y$};
\draw[color=red, domain=-10:10] plot[id=x] function{1/x} node[right] { $f(x) = x$ };
\end{tikzpicture}
\end{frame}
I'm not set on Tikz, if there are other options I am open to them.


gnuplotbut not withgnuplottex. You can see the manual to see how to plot a function with gnuplot. After you can try pgfplots or tkz-fct. – Alain Matthes Jun 16 '11 at 16:37! Number too big. \pgftemp@y. I'm using thebeamerpackage – Otto Allmendinger Jun 16 '11 at 16:49documentclasstobeamer. – N.N. Jun 16 '11 at 17:46restrict y to domain=-10:10is equivalent to a clip butunbounded coords=jumpis a very fine option ! – Alain Matthes Jun 16 '11 at 18:55