# Bad output for SwatchLegend using LegendMarker with an EdgeForm

Consider the following input which should give a legend with a red rectangle and a black frame:

SwatchLegend[{Red}, {"A"}, LegendMarkers -> {Graphics[{EdgeForm[
Directive[Black, Thickness[0.3]]], Rectangle[]}]},  LegendMarkerSize -> 80]


Using Mathematica 10.0.2 on linux I get:

Clearly, this is not the desired edge for the rectangle. Is this a bug or am I missing something?

Note: A simple workaround in this case is to draw a "frame" by adding a second rectangle behind the one I want that can act as a frame.

• I don't see a question here. What are asking us to do for you? – m_goldberg Mar 19 '16 at 21:53
• Nothing, I just want to know whether this is a bug or not. – JeffDror Mar 19 '16 at 21:53
• I don't think it's a bug. I think the edge is drawn somewhat transparent; i.e., with an opacity less than 1. – m_goldberg Mar 19 '16 at 22:01

Is this what you were expecting?

SwatchLegend[{Red}, {"A"},
LegendMarkers ->
{Graphics[{EdgeForm[Directive[Black, Thickness[0.3], Opacity[1]]], Rectangle[]}]},
LegendMarkerSize -> 80]


• Awesome, thanks! I wonder why SwatchLegend changes the opacity of the edge... – JeffDror Mar 19 '16 at 22:02

What you are seeing is the effect of default marker style for legend markers:

LegendingLegendDump$DefaultMarkerStyle  EdgeForm[Directive[Opacity[0.3], GrayLevel[0]]] If you like, you can reset the default edge opacity to Opacity[1]: LegendingLegendDump$DefaultMarkerStyle = EdgeForm[Opacity[1]];

SwatchLegend[{Red}, {"A"}, LegendMarkers -> {Graphics[{EdgeForm[
Directive[Black, Thickness[0.3]]], Rectangle[]}]},  LegendMarkerSize -> 80]