[Tex/LaTex] Make curves appear one by one in one plot in a beamer presentation

beameroverlayspgfplots

I want to put one figure with multiple curves in my beamer presentation, but I want to put a pause between the curves. It means that the curves appear in the plot one by one. The \pause option does not work. How can I do this?

\documentclass[10pt]{beamer}
\usepackage{tikz}
\usepackage{pgfplots}

\begin{document}

\begin{tikzpicture}
\begin{axis}

\addplot table {error1 };
\pause

\addplot table {error3};
\pause

\addplot table {error5};
\pause

\end{axis}
\begin{document}

Best Answer

Another option is using the visible on style:

\documentclass[10pt]{beamer}
\usepackage{pgfplots}

\tikzset{
    invisible/.style={opacity=0},
    visible on/.style={alt={#1{}{invisible}}},
    alt/.code args={<#1>#2#3}{%
      \alt<#1>{\pgfkeysalso{#2}}{\pgfkeysalso{#3}} % \pgfkeysalso doesn't change the path
    },
  }
  
\begin{document}

\begin{frame}
\begin{tikzpicture}
\begin{axis}
\addplot+[visible on=<1->] coordinates {(0,0) (5,3)};
\addplot+[visible on=<2->] coordinates {(0,-2) (5,-3)};
\addplot+[visible on=<3->] coordinates {(0,2) (5,0)};
\end{axis}
\end{tikzpicture}
\end{frame}

 \end{document}

An animation of the result:

enter image description here

Note that if you want to show the same graph on multiple slides seperated by comma, you must write the argument in curly brackets: {<1,3>}