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:

enter image description here

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.

  • $\begingroup$ I don't see a question here. What are asking us to do for you? $\endgroup$ – m_goldberg Mar 19 '16 at 21:53
  • $\begingroup$ Nothing, I just want to know whether this is a bug or not. $\endgroup$ – JeffDror Mar 19 '16 at 21:53
  • 1
    $\begingroup$ I don't think it's a bug. I think the edge is drawn somewhat transparent; i.e., with an opacity less than 1. $\endgroup$ – 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]


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

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.