Increasing the thickness of line in plot legend

I find it useful to stick with AbsoluteThickness (and related) when using PlotLegends.

Plot[{Sin[x], Cos[x]}, {x, 0, 2 \[Pi]}, PlotLegends -> Automatic, 
  PlotStyle -> AbsoluteThickness[2], AxesStyle -> AbsoluteThickness[2]]

enter image description here


If you remove Joined->False it seems that you can get a better length for the given line thickness:

Plot[{Sin[x], Cos[x]}, {x, 0, 2 \[Pi]}, 
PlotLegends -> 
LineLegend[Automatic, 
LabelStyle -> Directive[FontFamily -> "Helvetica", Medium], 
LegendMarkers -> 
Graphics[{Thickness[0.2], Line[{{-10, 0}, {10, 0}}]}]], 
PlotStyle -> Thickness[0.005], AxesStyle -> Thickness[0.005]]

thicker and longer lines


As a last resort you can always adjust LineLegend manually:

stl[n_, thick_] := Thread[{ColorData[97, "ColorList"][[;; n]], AbsoluteThickness@thick}];
leg = LineLegend[Directive@@@stl[2, 10], Automatic];
Plot[{Sin[x], Cos[x]}, {x, 0, \[Pi]}, PlotLegends -> leg]

enter image description here

I'm quite surprised that one can't do it in more usual way..

Tags:

Plotting