[Tex/LaTex] 3D figure using tikz-pgf – Intersection of two planes

tikz-pgf

I'm trying to draw a figure using tikz-pgf. This figure should have two planes in it: z=x and z=0. So far I've managed to write the following:

\documentclass[a4paper,12pt]{article}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
    \begin{axis}[domain=-1:1,y domain=-1:1]
        \addplot3[surf] {0};
        \addplot3[surf] {x};
    \end{axis}
\end{tikzpicture} 
\end{document}

But the result is weird, because it's not clear where the intersection of both planes is. I would like the plane z=0 to "cover" a bit of the plane z=x, as if the figure was viewed from above. Is there any easy way to do this?

Best Answer

You can use the method of this answer. There a combination of surface colors, opacities and plots get close to the desired result.

Your intersection is x=0, y=-1:1, z=0 with \addplot3+ you can draw this line. mark=none disables the marks. Optional you can use the style thick.

enter image description here

MWE:

\documentclass[a4paper,12pt]{article}
\usepackage{pgfplots}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
    \begin{axis}[domain=-1:1,y domain=-1:1]
        \addplot3[surf, opacity=0.35] {0};
        \addplot3[surf, opacity=0.35] {x};
        \addplot3+[mark=none,thick]({0},{y},{0});
    \end{axis}
\end{tikzpicture} 
\end{document}