[Tex/LaTex] Incorrect plot with pgfplots and gnuplot

gnuplotpgfplots

I'm attempting to plot atanh(x) although there seems to be a giant straight line linking the top and bottom points. Am I doing something wrong?

\documentclass{standalone}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
  \begin{axis}[no markers,samples=1001]
    \addplot gnuplot{atanh(x)};
  \end{axis}
\end{tikzpicture}
\end{document}

enter image description here

Best Answer

A – perhaps unsatisfactory – solution could be to restrict the y values to a certain domain.

\documentclass{standalone}
\usepackage{pgfplots}

\begin{document}
  \begin{tikzpicture}
    \begin{axis}[
      no markers,
      samples=1000,
      restrict y to domain=-2:2
    ]
      \addplot gnuplot{atanh(x)};
    \end{axis}
  \end{tikzpicture}
\end{document}

Derived from Section 4.21 of the »pgfplots« manual (p. 272).


enter image description here