4

I want to add 2 parabolas to a plot of a hyperbolic paraboloid, but I can't figure out (and couldn't find any information on the internet) how to keep pgfplots from closing the ends of the graphs. My plot looks like this:

\begin{tikzpicture}
\begin{axis}[
grid=major,
axis lines=middle,
inner axis line style={=>},
ticks=none
]
\addplot3 [draw=red,line width=1pt] ({x},0,{-x^2});
\addplot3 [draw=blue,line width=1pt] (0,{x},{x^2});
\addplot3 [surf,shader=flat,fill opacity=.4,draw=black] {y^2-x^2};
\end{axis}
\end{tikzpicture}

Plot

I basically want the same plot, only without the straight red and blue lines closing the parabolas.

1 Answer 1

5

Like this?

lineless

Based on page 119 of the manual, I think the problem is that pgfplots is creating a mesh. Of course, it is a very thin mesh, but it ends up drawing the unwanted line.

To prevent this, add samples y=0.

\documentclass[tikz,border=10pt,multi]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.12}

\begin{document}
\begin{tikzpicture}
  \begin{axis}[
    grid=major,
    axis lines=middle,
    inner axis line style={=>},
    ticks=none
    ]
    \addplot3 [draw=red,line width=1pt,samples y=0] ({x},0,{-x^2});% 119
    \addplot3 [draw=blue,line width=1pt,samples y=0] (0,{x},{x^2});
    \addplot3 [surf,shader=flat,fill opacity=.4,draw=black] {y^2-x^2};
  \end{axis}
\end{tikzpicture}
\end{document}
2
  • That's exactly what I intended. Thanks a lot!
    – Sora.
    Commented Jul 12, 2015 at 23:05
  • @Sora. OK. Good! I just about know what a parabola is (roughly) so 'hyperbolic paraboloid's have me rather lost ;).
    – cfr
    Commented Jul 12, 2015 at 23:13

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .