In some of my plots the curve description in the legend is too long, making the legend going over the plot, even if the legend is placed as far away as possible. Therefore I want to have multiple lines in the legend, but

\addlegendentry{a\\ b} 

results in an error. Is there another way to do that?


1 Answer 1


By default, TikZ nodes do not allow line breaks, but if you add the align=<left/right/center> key you can use \\. Hence, you can modify the legend style as below.


      legend style={cells={align=left}}
    \addplot {rnd};

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .