# PGFPlot, Legend line and legend text isnt on the same level

I have the following code:


\begin{tikzpicture}

\begin{axis}[legend style={at={(0.5,-0.1)},anchor=north}]

\addlegendentry{$x$}

\addlegendentry{$x^2$}

\end{axis}

\end{tikzpicture}


Unfortunately, as you can see in the picture, the legend text isnt at the same height as the legend line.

Do you know how to fix it?

Thank u very much! Andre

• Welcome to TSE. Please post a Minimal Working Example, instead of a code snippet. Jul 28 at 11:01
• I can't reproduce your problem. I get legend with text and symbols correct aligned. Jul 28 at 11:59
• i used: \pgfplotsset{compat=1.11, every axis legend/.style={ y tick label style={/pgf/number format/1000 sep=}, x tick label style={/pgf/number format/1000 sep=}}} Jul 28 at 13:05
• And what should this be good for? If you really should need it, replace .style by .append style. (By that you also get back the frame around the legend.) Jul 28 at 14:16

First of all thank u all for the fast respond :)

i probably found the problem: I used this code in \pgfplotsset{...}:

every axis legend/.style={
y tick label style={/pgf/number format/1000 sep=},
x tick label style={/pgf/number format/1000 sep=}}}


if i deactivate that, the legend is at a same height. BUT then i have another problem: my Legend is now framed, which i do not want. Does anybody know how to fix that? :D

• Welcome to TSE. That is another question. I suggest that you post it as such. Jul 28 at 13:30
• To remove the frame from the legend, add option legend style={draw=none} to the axis options or use \pgfplotsset{legend style={draw=none}} in the preamble.
– esdd
Jul 28 at 14:52