# How can I make my pgfplots ylabel multiline?

My pgfplots ylabel text is too long and looks strange. Can I make it multiline?

-

The ylabel can be adjusted like other nodes. The key you can use for this is ylabel syle={<options>}.

To make it multiline, you can either just provide a text alignment option, using align=<center/left/right/justify>, and then insert the line breaks manually with \\.

The second option is to provide a text width that the text should keep to, using text width=<width>, and it will automatically wrap around. By default, the text will be left aligned, but you can use the align key here, too.

\documentclass{minimal}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\begin{axis}[width=6cm,
ylabel style={align=center}, ylabel=A very long\\long\\text as a label,
xlabel style={text width=2.5cm}, xlabel=This is a long xlabel]