# LegendMarkerSize value equivalent to special character size in LegendMarkers

I am trying to find the equivalent LegendMarkerSize value to the size specified for special characters when using LegendMarkers. So far I found LegendMarkerSize 14 generates symbols close to 22 set for those characters. Please compare code below, one using Graphics for LegendMarkers, the other using special charaters:

SwatchLegend[{Red, Blue, Orange},{"2007", "2011", "2012"}, LegendMarkers-> {Graphics[Disk[{0, 0}]],Graphics[Polygon[{{1, 0}, {0, 1}, {-1, 0}, {0, -1}}]],Graphics[Rectangle[]]}, LegendMarkerSize -> 14]


and

PointLegend[{Red, Blue, Orange}, {"2007", "2011", "2012"},LegendMarkers -> {{"\[FilledCircle]", 22}, {"\[FilledDiamond]", 22}, {"\[FilledSquare]", 22}}]


Also as a side note, the symbol generated by LegendMarkers using Graphics seem to have a surrounding edge while the one using special character looks cleaner.

• Using LegendMarkers -> {{"\[FilledCircle]", 20}, {"\[FilledDiamond]", 22}, {"\[FilledSquare]", 27}} for the second example seems to produce roughly the same result as the first example. They are spaced farther apart, though. – DumpsterDoofus Oct 2 '14 at 0:35
• I have to use the first sample though... I tried assigning option ImageSize to Graphics, such as Graphics[Disk[{0, 0}], ImageSize -> 22], but changing the value doesn't change the size of the symbols. – Leonx Oct 2 '14 at 1:29
• BTW, regarding the surrounding edge, we can remove it by supplying EdgeForm[] in Graphics, eg, Graphics[{EdgeForm[], Disk[{0, 0}]}] – Leonx Oct 2 '14 at 2:06

There is no one-to-one equivalence because font glyphs and Graphics primitives are not rendered the same way. Essentially 22 in {"\[FilledCircle]", 22} is a font size whereas LegendMarkerSize is set as ImageSize which is in screen pixels. The issue then it to scale font size to fill a given pixel width which is a known difficult problem in Mathematica. See for example:

One observable difference is in the margin of each marker (font glyphs on the right):

Also note that the relative sizes (within a column above) are not the same; with the Graphics objects the orange square is larger than the blue diamond, whereas with the font glyphs these are apparently the same size.

If you describe your actual application that inspired this question I may have suggestions for improved workflow; otherwise I suggest you get used to using Graphics primitives if you want precise control of these things.

A graphical comment to Mr. Wizard's answer:

SwatchLegend[
63,
Range[3],
LegendMarkers -> {
Graphics[Disk[]],
Graphics[Polygon[{{1, 0}, {0, 1}, {-1, 0}, {0, -1}}]],
Graphics[Rectangle[]]}]


SwatchLegend[
63,
Range[3],
LegendMarkers -> {{"\[FilledCircle]", #}, {"\[FilledDiamond]", #}, \ {"\[FilledSquare]", #}}] &
[13.5]


Conclusion: There is no relationship. Don't use glyphs with LegendMarkers.