# Draw shifted plots from the same data

I need to draw a shifted plot from a data table (or a external file) without edit table coordinates. Using the shift={(x,y)} option works but x and y are not related to the axis coordinates s and f. Any advice?

\documentclass{article}

\usepackage{pgfplots}

\begin{document}

\begin{tikzpicture}
\begin{axis}[
xmin=0, xmax=1,
ymin=0, ymax=360,
xlabel=$s$,
ylabel=$f(s)$
]
s       f
0.0     75.9638
0.380665    75.9638
0.380665    206.565
0.58711     206.565
0.58711     243.435
0.793555    243.435
0.793555    333.435
1.0     333.435
};
\end{axis}
\end{tikzpicture}

\end{document}

-

The proper way to do achieve this is to use filters: You can use x filter/.code={<code>} to perform mathematical operations on the coordinates. Inside the <code> of an x/y filter, \pgfmathresult holds the current coordinate, and the content of \pgfmathresult at the end of the code will be used as the new coordinate. Alternatively, you can use the key disabledatascaling for the axis environment, then you'll be able to use the shift key in the way you tried it. This won't work with very large values that require the fpu library, however. The development version of PGFplots also supports using shift={(axis cs:<x>,<y>)}, which will work with large values.

\documentclass{article}

\usepackage{pgfplots}

\begin{document}

s       f
0.0     75.9638
0.380665    75.9638
0.380665    206.565
0.58711     206.565
0.58711     243.435
0.793555    243.435
0.793555    333.435
1.0     333.435
}\data

\begin{tikzpicture}
\begin{axis}[
xmin=0, xmax=1,
ymin=0, ymax=360,
xlabel=$s$,
ylabel=$f(s)$,
no markers
]

The second \addplot doesn't work for me: ! Undefined control sequence. <argument> \pgfplots@data@scale@trafo@EXPONENT@x l.28 \addplot +[shift={(axis cs:-0.1,10)}] t<<next line>>able \data; –  Fernando Nadal Jun 4 '11 at 13:27
@Fernando: Sorry, this only works in the development version. You have to use the disabledatascaling key, or use the x filter/.code. I've edited my answer accordingly. –  Jake Jun 4 '11 at 20:26
Thanks a lot, third \addplot works great for me anyway. –  Fernando Nadal Jun 4 '11 at 21:22