# Put legend (pgfplots) below the plot

I have a pgfplot where the legend is right to the plot. I create the plot as follows:

\begin{axis}[
scale only axis,
xmode=log,
ymode=log,
width=7cm,
legend cell align=left,
legend pos=outer north east,
legend style={draw=none}
]


Now I would like to move the legend down below the plot. So I thought I have just to replace legend pos=outer north east by legend pos=outer south west. But LaTex does not like this idea: Choice 'outer south west' unknown in key '/pgfplots/le gend pos'. Whats wrong with this?

-

From section 4.8.5 of the manual, you can use every axis legend:

\pgfplotsset{every axis legend/.append style={
at={(0,0)},
anchor=north east}}


Code: (partially from manual )

\documentclass{standalone}
\usepackage{pgfplots}
\pgfplotsset{width=7cm,compat=1.7}
\pgfplotsset{every axis legend/.append style={
at={(0,0)},
anchor=north east}}
\begin{document}
\begin{tikzpicture}
\begin{axis}
\legend{$l_1$,$l_2$,$l_3$}
\end{axis}
\end{tikzpicture}
\end{document}


Instead of the /.append style, it is possible to use legend style as in the following example. It has the same effect.

\documentclass{standalone}
\usepackage{pgfplots}
\pgfplotsset{width=7cm,compat=1.7}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
legend style={
at={(0,0)},
anchor=north east}]
\legend{$l_1$,$l_2$,$l_3$}
\end{axis}
\end{tikzpicture}
\end{document}


As percusse mentioned in comment, you can fine tune the position by at={(axis description cs:0,-0.1)} as in:

\documentclass{standalone}
\usepackage{pgfplots}
\pgfplotsset{width=7cm,compat=1.7}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
legend style={
at={(0,0)},
anchor=north east,at={(axis description cs:0,-0.1)}}]
\legend{$l_1$,$l_2$,$l_3$}

 When I try your solution and put anchor=north west, its exactly what I want but the x-axis labels are hidden by the legend. Any proposal how to circumvent this problem? – Thomas Witkowski Nov 19 '12 at 13:12 @ThomasWitkowski Use anchor=north west,at={( xticklabel cs:1)} or anchor=north west,at={(axis description cs:1.05,-0.05)} – percusse Nov 19 '12 at 13:15