3
$\begingroup$

How to stop folding in SwatchLegend? For example:

SwatchLegend[63, Range[20]]

outputs:

enter image description here

Is there a way to make them just one column?

This SwatchLegend[63, Range[20], LegendLayout -> "Column"] not work.

$\endgroup$

2 Answers 2

7
$\begingroup$
SwatchLegend[63, Range[20], LegendLayout -> {"Column", 1}]
$\endgroup$
2
  • 1
    $\begingroup$ How did you know this? I can't find it in the document. $\endgroup$
    – Y. zeng
    Sep 17, 2023 at 6:08
  • 1
    $\begingroup$ I spend some time here to compensate. This question is a duplicate of 265145 or 77151 and will be closed as the votes accumulate. $\endgroup$
    – Syed
    Sep 17, 2023 at 6:08
2
$\begingroup$

There should be better ways, but to help you in the meantime:

n = 20;

Column @ MapIndexed[Row[{#1, Spacer[10], #2[[1]]}] &] @
    Join[#, Take[#, n - Length[#]]] & @ ColorData[63, "ColorList"]

enter image description here

$\endgroup$

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.