# Plot legend without line break

I am having a plot with legend entries. The entries are not really long, it would be nice to have them in a single row. The default behavior adds a line break after each entry. Furthermore, the are all centered, I would prefer left flushed.

I did not find the correct parameter for changing that. Anyone any suggestions or pointers fore me?

• Are you using pgfplots? This is sort of impossible to answer without knowing how you created the plot and legend, so please add a minimal working example (MWE). – Torbjørn T. Mar 21 '14 at 22:22
• I see from your other question (that I also commented on) that you are indeed using pgfplots. Still, my previous comment applies. – Torbjørn T. Mar 21 '14 at 22:27
• Yes, sorry. I will add an MWE the next time. sry! – user1091534 Mar 21 '14 at 22:33

You can use the legend columns key (-1 makes all legends to go horizontally):

\documentclass{article}
\usepackage{pgfplots}

\begin{document}

\begin{tikzpicture}
\pgfplotsset{every axis legend/.append style={
at={(0.5,1.03)},
anchor=south}}
\begin{axis}[legend columns=-1]
\legend{$l_1$,$l_2$,$l_3$}