[Tex/LaTex] Rotating scaled tick labels

pgfplotstikz-pgftikz-styles

I have drawn a plot having scaled x-axis labels rotated as follows:

\begin{tikzpicture}
\begin{axis}
[
tiny,
width=0.56\columnwidth,
legend pos=north east,
legend style={font=\tiny},
xmajorgrids,
ymajorgrids,
y tick label style={
/pgf/number format/.cd,
    fixed,
    fixed zerofill,
    precision=2,
/tikz/.cd
},
scaled x ticks=base 10:-3,
xticklabel style={rotate=90},
legend entries={NP-GLM},
]
\addplot[color=purple,mark=*,mark size=1.1,] table{results.txt};
\end{axis}
\end{tikzpicture}
}

Resulting in the following figure:
enter image description here

Now the problem is that I don't want the scaling exponent 10^3 be rotated. Does anyone know how can I make it horizontal?

Best Answer

You can set the text of the 'scale label' manually by using the manual: for scaled x ticks:

\begin{tikzpicture}
    \begin{axis}
    [
        legend pos=north east,
        legend style={font=\tiny},
        grid,
        yticklabel style={
            /pgf/number format/.cd,
            fixed,
            fixed zerofill,
            precision=2,
        },
        scaled x ticks=manual:{\tikz \node[rotate=-90] {$\cdot 10^3$};}{\pgfmathparse{#1/1000}},
        xticklabel style={rotate=90},
        legend entries={NP-GLM},
    ]
    \addplot[color=purple,mark=*,mark size=1.1] table{results.txt};
    \end{axis}
\end{tikzpicture}

I used tikz to create a text node rotated in the other direction (-90). This works well, but the positioning of the node is not yet the original. I don't know what exactly you want here, so i left it that way. enter image description here

In my opinion, scaled ticks are quite ugly. Why is the value so big (ranging in thousands)? Perhaps you can change your unit? I don't know what data the xaxis holds, but maybe you could use kilometers instead of meters, hours instead of seconds and so on. In my experience, this also better reflects the data and actually helps understanding of it. Let's say we are talking about time here. If the xaxis was scaled in seconds, why would you care? This would be a process more happening in the scale of minutes or even fractions of hours. You would not think "I need around 900 seconds to the station", instead you would talk about 15 minutes.