# pgfplots: Hide curves from plot

Is there a way to hide the first two curves, so only the Total is shown?

Unfortunately, forget plot only excludes a curve from being listed in the legend.

\documentclass{standalone}

\RequirePackage{pgfplots}

\begin{document}

\begin{tikzpicture}
\begin{axis}[stack plots=y,
legend pos=outer north east,
minor x tick num=1,
minor y tick num=1,
ymin=0,
grid=both,
]
\addplot [forget plot, line width=0pt] coordinates {(0,1) (1,1) (2,2) (3,2)};  % HIDE from graph but use for Total
\addplot [forget plot, line width=0pt] coordinates {(0,1) (1,1) (2,2) (3,2)};  % HIDE from graph but use for Total
\addplot [line width=2pt, mark=*] coordinates {(0,1) (1,1) (2,2) (3,2)};

\legend{Total}
\end{axis}
\end{tikzpicture}

\end{document}


Even with line width=0pt, those lines are still visible...

Any help is appreciated. Thanks!

You can use draw=none:

\documentclass{standalone}

\RequirePackage{pgfplots}

\begin{document}

\begin{tikzpicture}
\begin{axis}[stack plots=y,
legend pos=outer north east,
minor x tick num=1,
minor y tick num=1,
ymin=0,
grid=both,
]
\addplot [forget plot, draw=none] coordinates {(0,1) (1,1) (2,2) (3,2)};  % HIDE from graph but use for Total
\addplot [forget plot, draw=none] coordinates {(0,1) (1,1) (2,2) (3,2)};  % HIDE from graph but use for Total
\addplot [line width=2pt, mark=*] coordinates {(0,1) (1,1) (2,2) (3,2)};

\legend{Total}
\end{axis}
\end{tikzpicture}

\end{document}


• Yay! Thanks!! That was too easy :-) – gilu Feb 22 at 10:51