# xlabel on top axis in pgfplots

I managed to get the x tick labels on the top axis of a plot, but the label of the x axis is still on the bottom axis. I couldn't find an option to get it to the top axis. Is this possible?

Minimal example

\documentclass{article}
\usepackage{tikz}
\usepackage{pgfplots}

\begin{document}
\begin{tikzpicture}
\begin{axis}[xticklabel pos=right, xlabel={My x label}]
\addplot coordinates { (1,1) (42,23) };
\end{axis}
\end{tikzpicture}
\end{document}


-
Why not xticklabel pos=upper? Interesting... –  percusse Nov 30 '11 at 15:26
:-) yeah, I tried that before, but it didn't work. I thought my version was too old and left it at pos=right. I tried it again just now and it worked. Must have been a typo back then. –  Flogo Nov 30 '11 at 15:45

You can add the xlabel near ticks option to get the label above the plot.

\begin{axis}[xticklabel pos=right, xlabel={My x label}, xlabel near ticks]

-

The requested feature has been added after pgfplots version 1.2.1 . Adding

\pgfplotsset{compat=1.3}

into the preamble will solve the problem globally.

In fact, this has the same effect as described by whlt3: it sets xlabel near ticks (among other keys).

-