0
$\begingroup$

I have the following test code

Plot[Evaluate@Table[Sin[i*Pi*x], {i, 0, 10}], {x, 1, 20}, 
 PlotLegends -> 
  SwatchLegend[{"#0", "#1", "#2", "#3", "#4", "#5", "#6", "#7", "#8", 
    "#9", "#10"} , 
   LegendMarkers -> Graphics[{EdgeForm[Black], Rectangle[]}], 
   LegendLabel -> "Legend", 
   LegendFunction -> (Framed[#, RoundingRadius -> 2] &), 
   LegendMargins -> 2], Frame -> True, 
 LabelStyle -> Directive[Black, FontSize -> 20], 
 FrameLabel -> {Style["\!\(\*
StyleBox[\"x\",\nFontColor->GrayLevel[0]]\)"], Style["SIN"]}, 
 ImageSize -> 800]

I would like to achieve two things:

  1. Arranging the elements in PlotLgends such that in the first column there are six elements and on the second the other five;
  2. Changing the FontSize different from that of the plot, I would like for example to make it smaller.
$\endgroup$

1 Answer 1

2
$\begingroup$
Plot[Evaluate@Table[Sin[i*Pi*x], {i, 0, 10}], {x, 1, 20}, 
 PlotPoints -> 100,
 MaxRecursion -> 5,
 PlotLegends -> 
  SwatchLegend[
   Style[#, 10] & /@
    {"#0", "#1", "#2", "#3", "#4", "#5", "#6", 
     "#7", "#8", "#9", "#10"},
   LegendLayout -> {"Column", 2},
   LegendMarkers -> Graphics[{EdgeForm[Black], Rectangle[]}],
   LegendLabel -> Style["Legend", 12], 
   LegendFunction -> (Framed[#, RoundingRadius -> 2] &), 
   LegendMargins -> 2,
   LegendMarkerSize -> 10],
 Frame -> True,
 LabelStyle -> Directive[Black, FontSize -> 20],
 FrameLabel -> {Style[
    "\!\(\*
StyleBox[\"x\",\nFontColor->GrayLevel[0]]\)"], 
   Style["SIN"]},
 ImageSize -> 800]

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.