3
$\begingroup$

I tried to make a plot markers manually as follows

PointLegend[ {Black} , {"a"}, 
 LegendMarkers -> {Graphics[{EdgeForm[{Black, AbsoluteThickness[2]}], 
     FaceForm[Transparent], Rectangle[]}]}] 

However, the color of resulting legend looks a bit whitened so in this case the resulting color looks grey instead of black.

Why was the color changed and how can I fix this problem?

$\endgroup$

2 Answers 2

4
$\begingroup$

If you look at the box form of your legend (using ToBoxes) you will see that the GraphicsBox representing your marker has the option

DefaultBaseStyle -> {"Graphics", {AbsolutePointSize[6]}, 
 Directive[EdgeForm[Directive[Opacity[0.3], GrayLevel[0]]], 
 PointSize[0.5], AbsoluteThickness[1.6], GrayLevel[0]]}

Note that it includes an Opacity[0.3] in the EdgeForm, as Opacity is a separate directive, setting the color to Black is insufficient to override it. So, instead, use

EdgeForm[{Black, AbsoluteThickness[2], Opacity[1]}]

instead.

$\endgroup$
3
$\begingroup$

A quick check by running ToBoxeson your example showed a couple of Opacity[0.3] in the output (not sure why this is done), causing the ligther color. This solved the problem for me:

PointLegend[{Black}, {"a"}, 
 LegendMarkers -> {Graphics[{EdgeForm[{Black, AbsoluteThickness[2], 
       Opacity[1]}], FaceForm[White], Rectangle[]}]}, 
 LegendMarkerSize -> 200]
$\endgroup$
1
  • $\begingroup$ Beet you by a couple of minutes, but +1 for the correct answer. $\endgroup$
    – rcollyer
    Aug 11, 2015 at 16:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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