# Incorrect relative node position in axis environment

I would like to draw a path in a graph plotted with pgfplots, using relative (++) coordinates. The following code compiles without any error, but the points are not at the desired position:

\documentclass{standalone}
\usepackage{pgfplots}

\begin{document}

\begin{tikzpicture}
\begin{axis}
\draw (1,2) --++ (0,1) --++ (1,0) --++ (0,1); % This should result in a staircase
\end{axis}
\end{tikzpicture}

\end{document}

Any idea of what causes this problem?

• I can't answer the question about the cause of the problem, but you might like to make the staircase with "const plot" instead. For example, try adding a new line: \addplot [red,const plot] {x^2}; – Thruston Jan 15 '17 at 14:20
• Thank you, but I am not particularly interested in plotting a staircase: this is just an simple example of a path based on relative coordinates. – Tobard Jan 15 '17 at 14:27

As you can find in the PGFPlots manual in 4.17.1 on page 349 (v1.14) you need to use axis direction cs to make relative coordinates work.

\documentclass[border=5pt]{standalone}
\usepackage{pgfplots}
% use this compat' level or higher so you don't need to state axis cs:'
% at the coordinates
\pgfplotsset{compat=1.11}
\begin{document}
\begin{tikzpicture}
\begin{axis}