3

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?

  • 1
    Welcome to TeX.SX! Please help us (and also you) and add a minimal working example (MWE), that illustrates your problem. Reproducing the problem and finding out what the issue is will be much easier when we see compilable code, starting with \documentclass and ending with \end{document}. – Bobyandbob May 6 '17 at 11:56
  • 1
    @Bobyandbob Thanks for the suggestion, I just edited the code. – Wild Feather May 6 '17 at 11:58
  • 1
    Maybe related and helpful: tex.stackexchange.com/q/73922/124842 or tex.stackexchange.com/a/52954/124842 – Bobyandbob May 6 '17 at 12:08
  • @Bobyandbob Thank you, I'll have a look but I doubt I can manage to solve it, it's the first time I try to draw a plot in Latex and that code seems complicated. – Wild Feather May 6 '17 at 12:12
2

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}
| improve this answer | |

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.