Here is a minimal working example:
\documentclass[12pt]{article}
\usepackage{amsmath}
\usepackage{enumerate}
\usepackage{tikz}
\usepackage{xcolor}
\usepackage{tikz-3dplot}
\usepackage{hyperref}
\usepackage{ifthen}
\usepackage{pgfplots}
\pgfplotsset{compat=1.11}
\begin{document}
\begin{tikzpicture}
\begin{axis}[samples=60]
%\addplot3[surf, domain=-2:2] {x^2-y^2};
% y=constant grids lines
\foreach \yy in {-2.0,-1.0,...,2.0}
{
\addplot3[domain=-2:2, line width=0.1mm, mark=none, color=red]
({x}, {\yy}, {x^2-\yy*\yy});
}
\end{axis}
\end{tikzpicture}
\end{document}
The question is: Why is pgfplots joining my first and last sample values? The horizontal lines on top should not be there. The equation plotted here is the saddle x^2-y^2=z. In the code I fixed $y=-2,-1,0,1,2$, and varied x between -2 and 2.
Thanks.


\addplot3[surf,mesh,domain=-2:2, line width=0.1mm, mark=none, color=red]({x}, {y}, {x^2-y^2});– percusse Nov 13 '15 at 23:09