Some time ago, I requested your help on creating axis labeling, that is compliant with the German standard DIN 461 (my older question). Thanks Jake for the good answer, that is working well in most cases!
Now I recently came across a problem, where the axis is getting "auto scaled" by the help of an axis scale. However, in that case, the above mentioned approach did not work well - better to say, it didn't work at all.
Here, the adpoted example code of the above mentioned solution:
\documentclass{standalone}
\usepackage{pgfplots}
\usepackage{siunitx}
\usetikzlibrary{calc}
\pgfplotsset{
din xlabel/.style={
xticklabel style={
name=label\ticknum,
append after command=\pgfextra{\xdef\lastticknum{\ticknum}}
},
after end axis/.code={
\pgfmathparse{int(\lastticknum-1)}
\path (label\lastticknum.base) -- (label\pgfmathresult.base) node [midway, anchor=base] {#1};
}
}
}
\begin{document}
% === That one is working ===
\begin{tikzpicture}
\begin{axis}[din xlabel=\si{\celsius}]
\addplot table {
0 1
2 1
3 2
4 3
};
\end{axis}
\end{tikzpicture}
% === This one not ===
\begin{tikzpicture}
\begin{axis}[din xlabel=\si{\celsius}, xtick = data]
\addplot table {
0.001 1
0.002 1
0.003 2
0.004 3
};
\end{axis}
\end{tikzpicture}
\end{document}
The result:
And the corresponding error: Undefined control sequence. label\ticknum
Obviously, the ticknum variable is not defined or not accessible. Unfortunately, I'm not that deep into how the axes and the ticks in particular, are generated. It would be great, if someone could shed a light on why axes with scale are treated differently than the "normal" ones. Solutions (or approaches) are appreciated as well. ;-)
Thanks in advance!

