# Positioning of Pgfplot axis labels

I'm trying to adjust the position of my axes labels and I'm having some trouble:

\documentclass{article}
\usepackage{float}
\usepackage{pgfplots}
\usepackage{graphicx}
\begin{document}
\begin{figure}[H]
\centering
\begin{tikzpicture}
\begin{axis}[
axis lines=middle,
axis line style={->},
x label style={at={(current axis.right of origin)},anchor=north, below=5mm},
y label style={at={(current axis.above origin)},rotate=90,anchor=south east},
xlabel={$u$ unemployment},
ylabel={$\pi$ inflation}]
\end{axis}
\end{tikzpicture}
\end{figure}
\end{document}


It may be that I don't understand the label style stuff, but I want the y label to be rotated and on the left of the y-axis (so it doesn't intersect with the ticks) and I want the x label to be below the x-axis (so it also doesn't run into ticks). Also, is there a way to center the labels in those positions?

You can control the position of labels accurately with

at={(axis description cs:0.5,-0.03)}


The start of the axis is 0 and the end is 1.

\documentclass{article}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
axis lines=middle,
axis line style={->},
x label style={at={(axis description cs:0.5,-0.1)},anchor=north},
y label style={at={(axis description cs:-0.1,.5)},rotate=90,anchor=south},
xlabel={$u$ unemployment},
ylabel={$\pi$ inflation}]
\end{axis}
\end{tikzpicture}
\end{document}


You can use the xlabel near ticks and ylabel near ticks styles. These will automatically place the labels outside the ticks, whereas with Harish's solution you have to manually change the position to accommodate larger ticklabels. They are described in section 4.9.3 Labels of the manual, and are defined as

\pgfplotsset{
/pgfplots/xlabel near ticks/.style={
/pgfplots/every axis x label/.style={
at={(ticklabel cs:0.5)},anchor=near ticklabel
}
},
/pgfplots/ylabel near ticks/.style={
/pgfplots/every axis y label/.style={
at={(ticklabel cs:0.5)},rotate=90,anchor=near ticklabel}
}
}


Code example:

\documentclass{article}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
axis lines=middle,
axis line style={->},
ylabel near ticks,
xlabel near ticks,
xlabel={$u$ unemployment},
ylabel={$\pi$ inflation}]