Skip to main content
added 476 characters in body
Source Link
kglr
  • 403.4k
  • 18
  • 501
  • 959

You can use the option setting LegendLayout -> {"Row", 1} inside LineLegend to have all legends in a single row:

Plot[Evaluate[Sin[# x] & /@ Range[7]], {x, 0, 2 Pi}, PlotLegends -> Placed[LineLegend["Expressions", LegendLayout -> {"Row", 1}], Above]] 

enter image description here

Or, use a custom function as the setting for this option to organize legends in a Grid with a single row:

Plot[Evaluate[Sin[# x] & /@ Range[7]], {x, 0, 2 Pi}, PlotLegends -> Placed[LineLegend["Expressions", LegendLayout -> (Grid[{Flatten@Riffle[#, Spacer[3]]}] &)], Above]] 

Mathematica graphics

Plot[Evaluate[Sin[# x] & /@ Range[7]], {x, 0, 2 Pi}, PlotLegends -> Placed[LineLegend["Expressions", LegendLayout -> (Grid[{Flatten@Riffle[#, Spacer[3]]}] &)], Above]] 

Mathematica graphics

You can use the option setting LegendLayout -> {"Row", 1} inside LineLegend to have all legends in a single row:

Plot[Evaluate[Sin[# x] & /@ Range[7]], {x, 0, 2 Pi}, PlotLegends -> Placed[LineLegend["Expressions", LegendLayout -> {"Row", 1}], Above]] 

enter image description here

Or, use a custom function as the setting for this option to organize legends in a Grid with a single row:

Plot[Evaluate[Sin[# x] & /@ Range[7]], {x, 0, 2 Pi}, PlotLegends -> Placed[LineLegend["Expressions", LegendLayout -> (Grid[{Flatten@Riffle[#, Spacer[3]]}] &)], Above]] 

Mathematica graphics

Source Link
kglr
  • 403.4k
  • 18
  • 501
  • 959

Plot[Evaluate[Sin[# x] & /@ Range[7]], {x, 0, 2 Pi}, PlotLegends -> Placed[LineLegend["Expressions", LegendLayout -> (Grid[{Flatten@Riffle[#, Spacer[3]]}] &)], Above]] 

Mathematica graphics