# Rotating scaled tick labels

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},
]
\end{axis}
\end{tikzpicture}
}


Resulting in the following figure:

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?

• Welcome! Thanks for providing code. However, it would be even better if you could post compilable code next time i.e. code for a minimal but complete document people can copy-paste to reproduce the problem. Otherwise, people have to guess what needs adding to get the output you have, which is always rather hit-and-miss and means helping takes more time, so fewer people are likely to answer. – cfr Dec 25 '16 at 1:54
• @Down-Voter I don't know why this was down-voted, but please do not down-vote without leaving a comment explaining how the question may be improved. Especially for a question asked by a new user. In any case, voting this down seems egregious. Perhaps you just got a parking ticket or burnt the toast. If so, even more important to comment so that the OP knows there is nothing which s/he could have done to avoid your displeasure short of furnishing you with a new toaster or suggesting the use of public transport. – cfr Dec 25 '16 at 1:59
• @cfr Yeah, you're right about reproducible code. Thanks. – sisaman Dec 25 '16 at 11:22

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},
]
\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.

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.

• Thanks! Worked like a charm! About the values in the x-axis, they had no unit, just raw quantities. – sisaman Dec 25 '16 at 10:54

You can rotate back the scale label using the x tick scale label style key:

\documentclass[tikz]{standalone}

\usepackage{pgfplots}
\usepackage{filecontents}

\begin{filecontents*}{results.txt}
100 0.14999
200 0.093685
300 0.071138
400 0.058515
500 0.050288
600 0.044433
700 0.040017
800 0.036549
900 0.033739
1000 0.03141
1100 0.029442
1200 0.027753
1300 0.026285
1400 0.024995
1500 0.023851
1600 0.022828
1700 0.021908
1800 0.021074
1900 0.020314
2000 0.019619
\end{filecontents*}

\begin{document}

\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},
x tick scale label style={rotate=-90},
legend entries={NP-GLM},
]