# How to raise the LegendLayout "Row" size

When using LegendLayout->"Row", with a lengthy row, I get line breaks. This would seemed logic if it was confined by another structure. But if happens even when there's no "confinement":

LineLegend[{Blue, Orange, Green}, {"this is a big test",
"this is a big test", "this is a big test"}, LegendLayout -> "Row"]


How can I change the ItemSize/ImageSize of the Legend?

(should this behavior be reported?)

Tell it that you really want n rows by {"Row", n}, for example:

LineLegend[{Blue, Orange, Green}, {"this is a big test",
"this is a big test", "this is a big test"},
LegendLayout -> {"Row", 1}]

• This construct for LegendLayout really needs to be inside the documentation. It is extremely useful Jul 31, 2013 at 1:07

To avoid line breaks You can use Grid insted (more here):

f[x_] := Grid[{Flatten@x}];

LineLegend[{Blue, Orange, Green}, {"this is a big test",
"this is a big test", "this is a big test"}, LegendLayout -> f]


Edit

Strange thing that I can not put pure function to LegendLayout option :/ If You don't want to define f outside, use: LegendLayout->Function[{x}, Grid@{Flatten@x}].

• try: LegendLayout -> (Grid[{Flatten@#}] &), that should do the trick (for the pure function that is) Jun 1, 2013 at 9:07
• The reason you need the parentheses is & has a lower precedence than ->. If you run FullForm[q -> #&] you get Function[Rule[q, Slot[1]]], but add parentheses: FullForm[q -> (#&)] you get, Rule[q, Function[Slot[1]]]. Jun 10, 2013 at 14:14