# pgfplot: 3D version of a plane and its the gradient vector [closed]

Checking pgfplot for the addplot3-command was easy! I've found this very nice possibility to plot a plane:

\begin{tikzpicture}
\begin{axis}
surf,
mesh,
]
{x+y+1};
\end{axis}
\end{tikzpicture} But to emphasize the meaning of the gradient vector I would like to add a vector (1,1,0). Furthermore I need labels for my coordinate system. And how can I add points, e.g. "the origin", to indicate that the functions returns 1 for x=y=0? Thanks for advice.

Here is a specification of the underlying problem: adding a circle or vector refers to the invisible 2d-coordinate system but not to the one plotted.

\begin{tikzpicture}
\begin{axis}
surf,
mesh,
]
{x+y+1};
\end{axis}
\draw[->] (1,1,0) -- (2,2,0);
\draw (0,0,1) circle (10pt);
\end{tikzpicture} \begin{center}
\begin{tikzpicture}
\begin{axis}[
xlabel={$x$},
ylabel={$y$}]
surf, mesh
]
{x+y+1};
\draw[->, ultra thick] (0,0,0) -- (1,1,0);
\fill[red] (0,0,0) circle (2pt);
\draw[->] (1,1,0) -- (2,2,0);
\end{axis}
\end{tikzpicture}
\end{center} Of course I just mixed up the environment of the addplot3 with the axis environment and possible other subsequent elements. Everythings fine now.

• Just like with any other axis, you can use the regular TikZ drawing commands to add lines, nodes, etc. to the plot, with the usual 3D coordinate, e.g. \draw[->] (0,0,0) -- (1,1,0) May 19, 2016 at 15:50
• Let me specify my problem. The coordinate system drawn is different from what my code works with.
– Mac
May 19, 2016 at 16:11
• You need put the \draw commands inside the axis environment, and you need to set \pgfplotsset{compat=1.12} or use (axis cs:0,0,0) instead of (0,0,0).
– Jake
May 19, 2016 at 16:38
• @Mac I agree with Jake (and I should have been more explicit). You can also use \pgfplotsset{compat=1.13} in the preamble (and I would recommend to use 1.13 which is the most recent version, unless you have a compelling reason to use an older version) May 19, 2016 at 16:57
• I'm voting to close this question because it is solved in the comments. Feb 25, 2017 at 14:13