# How to make lines in Plot Legends wider?

1.- How to put DASHED lines in the Legend? 2.- How to give Style to {20,Bold} to all "Expressions in Legend?

(I use LegendMarkSize for make lines wider than default fine style )

Plot[{{E^(x/(1/4)), E^(x/(1/3)), E^(x/(1/2))}, {E^(x/1), E^(x/2),
E^(x/3), E^(x/4)}}, {x, -5, 0.2},
PlotStyle -> {{Dashing[0.024], Thickness[0.01]}, {Dashing[0.024],
Thickness[0.01]}, {Dashing[0.024], Thickness[0.01]},
Thickness[0.01], Thickness[0.01], Thickness[0.01],
Thickness[0.01]},
PlotLegends ->
SwatchLegend[ "Expressions", LegendMarkerSize -> {39, 6}],
PlotRange -> {{-5, 0.15}, {0, 1.15}}]

The style for labels in a legend is determined by the option LabelStyle. To get the legend markers to match the style of the plot without rescaling, one approach is to use AbsoluteDashing and AbsoluteThickness to style the plot lines.

With[{d = AbsoluteDashing[8], t = AbsoluteThickness[4]},
Plot[{E^(4 x), E^(3 x), E^(2 x), E^x, E^(x/2), E^(x/3), E^(x/4)}, {x, -5, 0.2},
PlotStyle -> {{d, t}, {d, t}, {d, t}, t, t, t, t},
PlotRange -> {{-5, 0.15}, {0, 1.15}},
PlotLegends -> LineLegend["Expressions",
LabelStyle -> {Bold, 20}, LegendMarkerSize -> {40, 10}]]]

• Thank you, your solution is perfect!. only have to add... {Bold,20} to maintain the axis numbers bigger. Thank you May 3, 2014 at 15:42

AbsoluteDash and AbsoluteThickness are helpful in this. In the following I have arbitrarily chosen colours for illustrative purposes (so you can change as desired):

leg = {{Red, AbsoluteDashing[5], AbsoluteThickness[2]}, {Green,
AbsoluteDashing[5], AbsoluteThickness[2]}, {Blue,
AbsoluteDashing[5], AbsoluteThickness[2]}, {Red,
AbsoluteThickness[2]}, {Green, AbsoluteThickness[2]}, {Blue,
AbsoluteThickness[2]}, {Purple, AbsoluteThickness[2]}};
fns = {{E^(x/(1/4)), E^(x/(1/3)), E^(x/(1/2))}, {E^(x/1), E^(x/2),
E^(x/3), E^(x/4)}};
Plot[fns, {x, -5, 0.2}, PlotRange -> {{-5, 0.15}, {0, 1.15}},
PlotStyle -> leg,
PlotLegends -> LineLegend[Directive @@@ leg, Flatten@fns]]

This yields:

• You´re answer is TOO an SOLUTION FOR ME. I chosed the other because was posted before. May 3, 2014 at 13:41
• @MikaIke thanks...that's fine I think Simon Woods is neater (note he flattened your list of expressions which were nested in your code: I flattened in my legend) May 3, 2014 at 13:45
• (+1), is there any way to adjust the length of lines in the legend? Sep 19, 2019 at 12:22