I want to draw the plane x+y=1 in pgfplots. In this example, z is free and is not explicitly a function of x and y. So I cannot use

\addplot3[surf, fill=blue, opacity=0.1, fill opacity=0.4] {z=whatever};

I cannot parametrize the plane either, because the following syntax, instructing to take z to be free does not work:

\addplot3[surf, fill=blue, opacity=0.1, fill opacity=0.4] {x,-x+1,{}};

How can I do that? Perhaps by using scope and switching x and z axes, so that I can use one of the above standard syntax.

  • Is this all you want to plot? Or together with other elements? You could do The first version with 1 - x and exchange the y and z axis labels.
    – MaxNoe
    Commented Apr 14, 2015 at 20:13
  • There are other graphs too. Can't just change labels.
    – eli
    Commented Apr 14, 2015 at 21:26

1 Answer 1

    \addplot3[name path=toppath,fill=blue, opacity=0.1, fill opacity=0.4,samples=2] (x,-x+1,5);
    \addplot3[name path=botpath,fill=blue, opacity=0.1, fill opacity=0.4,samples=2] (x,-x+1,-5);
    \addplot [gray] fill between[of=toppath and botpath];

enter image description here

You must log in to answer this question.

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