I would like to display points in a Tikz picture, whose y components are all negative. That is per se no problem, but I want the y axis to be a bit higher than the x axis to emphasize the negative values.
See the screenshots below the code.
In another file with different data I got it perfectly working using Jake's approach to move the coordinate axes. However, in the file below increasing the y intersection coordinate (axis line origin={0,THIS}) only adds weird whitespace before the Tikz picture.
No warnings (except the one for filecontents) are shown.
What is the reason for this behavior? How can I fix it?
(Note: I'm also open to suggestions not involving Jake's code anymore as long as my desired result is produced.)
MWE:
\documentclass[tikz,border=2pt]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.9}
\usepackage{filecontents}
\usepackage[utf8]{luainputenc}
% Author: Jake <https://tex.stackexchange.com/users/2552/jake>
% Link: https://tex.stackexchange.com/a/62431/38074
% License: CC BY-SA 3.0
\pgfplotsset{
axis line origin/.style args={#1,#2}{
x filter/.append code={ % Check for empty or filtered out numbers
\ifx\pgfmathresult\empty\else\pgfmathparse{\pgfmathresult-#1}\fi
},
y filter/.append code={
\ifx\pgfmathresult\empty\else\pgfmathparse{\pgfmathresult-#2}\fi
},
xticklabel=\pgfmathparse{\tick+#1}\pgfmathprintnumber{\pgfmathresult},
yticklabel=\pgfmathparse{\tick+#2}\pgfmathprintnumber{\pgfmathresult}
}
}
\begin{filecontents*}{data.csv}
Data
t;x;y
0.000000000E0;6.348840913E-4;9.925120686E-4
8.333333333E-3;5.838627285E-4;4.724618695E-4
1.666666667E-2;1.094161960E-3;-2.700310368E-3
2.500000000E-2;7.550411425E-4;-5.097581518E-3
3.333333333E-2;6.794111604E-4;-9.011432646E-3
4.166666667E-2;3.461038282E-4;-1.562674575E-2
5.000000000E-2;1.282057031E-4;-1.909622209E-2
5.833333333E-2;-3.401256682E-4;-2.518409682E-2
1.408333333E0;-3.104116765E-2;-1.739549231E0
1.416666667E0;-3.322785461E-2;-1.740279419E0
1.425000000E0;-3.599135975E-2;-1.742337105E0
1.433333333E0;-3.808925614E-2;-1.744682891E0
1.541666667E0;-7.108984101E-2;-1.839024730E0
1.550000000E0;-7.297102460E-2;-1.857275769E0
1.558333333E0;-7.571494352E-2;-1.870979850E0
1.566666667E0;-7.854608723E-2;-1.892338940E0
1.575000000E0;-8.274961995E-2;-1.897014288E0
\end{filecontents*}
\begin{document}
\begin{tikzpicture}
\pgfplotsset{ticks=none}
\begin{axis}[
axis x line=right,
axis y line=left,
axis lines=middle,
axis line origin={0,0.5},
xlabel=Time,
ylabel=x,
xticklabel style={inner xsep=0pt, anchor=north west},
xtick={0},
after end axis/.code={
\path (axis cs:0,0)
node [anchor=south east,xshift=-0.075cm] {0};
}
]
\addplot[color=red,ultra thick] table [
skip first n=1,
col sep=semicolon,
x=t,
y=y
] {data.csv};
\end{axis}
\end{tikzpicture}
\end{document}
Current result:

The result I'd like:

