5
$\begingroup$

I have Plot such as

Plot[{x, x^2, x^3}, {x, -10, 10}, Frame -> True, Axes -> False, 
 ImageSize -> 1020, PlotStyle -> AbsoluteThickness[3],
 PlotLegends -> 
  Placed[LineLegend[{"Meow1", "Meow2", "Meow3"}, 
    LegendFunction -> "Frame", 
    LabelStyle -> {FontSize -> 50}], {Right, Bottom}]]

enter image description here

But I want to only increase the plot legend bar such as (I used Paint) enter image description here

Any advice to increase the plot legend bar?

$\endgroup$
7
$\begingroup$

Update: An alternative approach to post-process Plot output to make the legend lines thick:

ClearAll[makeThick, postProcess]
makeThick[t_: 15] := RawBoxes[Replace[ToBoxes@#, 
     LineBox[x_] :> {AbsoluteThickness[t], LineBox[x]}, Infinity]] &;
postProcess[t_: 15] := # /. leg_LineLegend :> (makeThick[t][leg]) &;

Example:

plt = Plot[{x, x^2, x^3}, {x, -10, 10}, 
   PlotStyle -> (Hue /@ RandomReal[1, {3}]), Frame -> True, 
   Axes -> False, ImageSize -> 500, BaseStyle -> AbsoluteThickness[3],
    PlotLegends -> Placed[LineLegend[{"Meow1", "Meow2", "Meow3"}, 
      LegendFunction -> "Frame", LegendMarkerSize -> {{30, 10}}, 
      LabelStyle -> {FontSize -> 24}], {Right, Bottom}]];

Row[{plt, postProcess[]@plt}]

Mathematica graphics

Original post:

 legend = LineLegend[Thread[Directive[ColorData[97, "ColorList"][[;; 3]], 
      AbsoluteThickness[10]]], {"Meow1", "Meow2", "Meow3"}, 
  LegendMarkerSize -> Large, LegendFunction -> "Frame", 
  LabelStyle -> {FontSize -> 50}]

Mathematica graphics

and use it as the setting for PlotLegends in Plot as:

Plot[{x, x^2, x^3}, {x, -10, 10}, Frame -> True, Axes -> False, 
 ImageSize -> 1020, PlotStyle -> AbsoluteThickness[3], 
 PlotLegends -> Placed[legend, {Right, Bottom}]]
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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