I saw this piece of code from an answer by @Syed here.

LineLegend[{Blue, Green, Red}, {"a = test1\na = test2", 
  "a = test3\na = test4", "a = test5\na = test6"}, 
 LegendLayout -> {"Row", 1}, 
 LegendMarkers -> {{"\[FilledCircle]", 15}, {"\[FilledUpTriangle]", 
    15}, {"\[FilledSquare]", 15}}]

At first, I noticed LegendLayout -> {"Row", 1} which is new to me.
So I checked the documentation for LegendLayout and didn't see any example where they used something like {"Row", 1}.
After that I tried the code and changed {"Row", 1} to {"Row", 2} and {"Row", 3} and finally realized that this number indicates number of rows.

Does this usage exist in the documentation as I don't really see it?
If not then how would you learn something like this, from books, someone or just discover it by accident?
I know this is very simple for most of you but it's confusing for a beginner like me.

  • $\begingroup$ @Syed as you are the person who wrote it can you answer the question? $\endgroup$
    – emnha
    Commented Apr 20, 2022 at 23:04
  • 1
    $\begingroup$ I recall seeing this usage in this answer by @kglr. $\endgroup$
    – Syed
    Commented Apr 21, 2022 at 3:46
  • $\begingroup$ @kglr I wonder if you could give some information. $\endgroup$
    – emnha
    Commented Apr 21, 2022 at 7:23
  • 1
    $\begingroup$ Perhaps a noteworthy comment: it seems that LegendLayout shares the same options settings as PlotLayout, i.e {Or["Column","Row"], n} with n a positive integer. It was used here for the latter. $\endgroup$
    – bmf
    Commented Apr 22, 2022 at 18:23

1 Answer 1


Since there are no other answers, I will venture something. It is not a full answer, but I think the links and comment-like structure might be useful.

This is an undocumented option for LegendLayout. As it has been pointed out by the author of the OP it works like so:

LegendLayout -> {"Row", # of rows}

and likewise for columns and, of course, their reversed versions.

The oldest post on this site that I managed to find about this matter is the answer by rcollyer.

There's another, earlier, mention of undocumented options for LegendLayout - see this thread, though not as explicit as the first link. However, in the latter link you can find various ways of going about finding and understanding these things.

From the link above I suggest that you adopt the answer by Mr.Wizard; namely using // Trace // InputForm and then following the logic outlined thereof.

  • $\begingroup$ Thank you. Good to know that it's undocumented option. I always wonder how can they miss not document this important option. $\endgroup$
    – emnha
    Commented Apr 30, 2022 at 20:45
  • $\begingroup$ I tried Plot[{x, 1 + x}, {x, -3, 3}, PlotLegends -> "Expressions"] // Trace // InputForm and see LegendLayout -> "Column" but it doesn't really show the option for number of columns. $\endgroup$
    – emnha
    Commented Apr 30, 2022 at 20:54
  • $\begingroup$ @emnha I am not quite sure why some options are left undocumented to be honest. And I cannot begin to imagine a reason. I am pretty sure that there is one, I just don't see it. With regards to the second comment, I will try to work more on that and get back later in the week :) $\endgroup$
    – bmf
    Commented May 1, 2022 at 17:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.