1
$\begingroup$

In reference to "https://mathematica.stackexchange.com/questions/267013/how-to-change-layout-of-a-legend-in-show-function", the solution is provided. My question is:

If I have 5 curves each in plot300 and plot400, which corresponds to 5 legend points in each. Now I plotted them separately where I used a command Plot[PlotLegends->Placed["Expressions",Below]]. While combining the two plots, I used Show[plot300,plot400].The output here shows the legends placed below the graph in one single row. Is it possible to place legend points such that it takes 2 rows displaying 5 points each, while using the show command? Basically, the legends should be within the width of the graph and should not extend beyond it.

$\endgroup$

1 Answer 1

1
$\begingroup$
$Version

(* "14.0.0 for Mac OS X ARM (64-bit) (December 13, 2023)" *)

Clear["Global`*"]

func300 = Exp[-#*t] & /@ Range[0.01, 0.09, 0.02];

func400 = Exp[-#*t] & /@ Range[0.02, 0.1, 0.02];

Plot300 = Plot[Evaluate[Tooltip /@ func300], {t, 0, 100},
   PlotStyle -> "SolarColors"];
Plot400 = Plot[Evaluate[Tooltip /@ func400], {t, 0, 100},
   PlotStyle -> "LakeColors"];

P1 = Legended[
  Show[Plot300, Plot400],
  Placed[
   LineLegend[
    Join[
     ColorData["SolarColors"][#] & /@ Subdivide[4],
     ColorData["LakeColors"][#] & /@ Subdivide[4]],
    Join[func300, func400],
    LegendLayout -> {"Row", 2}],
   Below]]

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.