1

The contour is drawn on the top surface, I'm trying to plot the contour on the floor (A-B).enter image description here

\documentclass{standalone}

\usepackage{pgfplots}
\pgfplotsset{width=10cm, compat=1.9}

\begin{document}

\begin{tikzpicture} \begin{axis}
    [
    xlabel=$A$,
    ylabel=$B$,
    zlabel=$f_0$,
    grid=major,
    ]


\addplot3[
    surf,
    opacity=0.4,
    ] {4*x + 5*y};

\addplot3 [
contour gnuplot, samples=21]
        {4*x + 5*y};

\end{axis} \end{tikzpicture}

\end{document}
  • \addplot3 [ contour gnuplot, samples=21,z filter/.code={\def\pgfmathresult{-49.9}}] {4*x + 5*y}; ? (Or any value you want instead of -49.9.) – user121799 Mar 5 at 19:08
  • I tried that, this changes the contour height, but it's not on the floor perfectly. – Taha Magdy Mar 5 at 19:10
1
\documentclass[tikz,border=3.14mm]{standalone}
\usepackage{pgfplots}
\pgfplotsset{width=10cm, compat=1.9}
\begin{document}
\begin{tikzpicture} 
 \begin{axis}[
     xlabel=$A$,
     ylabel=$B$,
     zlabel=$f_0$,
     grid=major,zmax=55,zmin=-55
     ]


 \addplot3[
     surf,
     opacity=0.4,
     ] {4*x + 5*y};

 \addplot3 [
 contour gnuplot, samples=21,z filter/.code={\def\pgfmathresult{-54.9}}]
         {4*x + 5*y};

 \end{axis} 
\end{tikzpicture}

\end{document}

enter image description here

  • Could you explain please, how to make the contour on the floor like that? is it just trying numbers, is there a concrete way? – Taha Magdy Mar 5 at 19:23
  • 1
    @TahaMagdy I just set zmin to -55 and added the contour a tiny bit above (such that it does not clipped away). – user121799 Mar 5 at 19:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.