I am making a simple plot with a legend:

ListPlot[{{1, 1}, {2, 2}}, PlotStyle ->Red, 
  PlotLegends -> Placed[PointLegend[{Style["data 1", FontSize -> 20]},
  LegendFunction -> (Framed[#, Background -> White, 
     FrameStyle -> Directive[Black, Thick]] &)],
  Scaled[{0.9, 0.15}]]
]

How to change the size of the symbol in the legend? I am using Mathematica 10.0.2.

  • 1
    Look up LegendMarkerSize. – Szabolcs Sep 14 at 8:49
up vote 3 down vote accepted

You can use the option setting LegendMarkers -> {Automatic, 20}:

ListPlot[{{1, 1}, {2, 2}}, PlotStyle -> Red, 
 PlotLegends -> Placed[PointLegend[{Style["data 1", FontSize -> 20]}, 
    LegendMarkers -> {Automatic, 20}, 
    LegendFunction -> (Framed[#, Background -> White, 
        FrameStyle -> Directive[Black, Thick]] &)], 
   Scaled[{0.85, 0.15}]]]

enter image description here

Alternatively, you can specify the PointSize in the first argument of PointLegend, e.g., using

PointLegend[{Directive[Red, PointSize[Large]]}, {Style["data 1", FontSize -> 20]}, 
 LegendFunction -> (Framed[#, Background -> White, 
     FrameStyle -> Directive[Black, Thick]] &)]

in the code above gives

enter image description here

  • If I do SetOptions[PlotLegends, LegendMarkers -> {Automatic, 20}] then I get an error LegendMarkers is not a known option for PlotLegends. >>. So, how to handle LegendMarkers in Options? – Luigi Sep 17 at 7:47
  • @Luigi, PlotLegends does not have any options. You can try SetOptions[PointLegend, LegendMarkers -> {Automatic, 20}] . This should work (but it doesn't in version 9). – kglr Sep 17 at 8:04
  • it does not work, also in version 10.0.2 – Luigi Sep 17 at 8:20
  • do we see workarounds? – Luigi Sep 17 at 8:40
  • @Luigi, a workaround is to use SetOptions[PointLegend, LegendMarkers -> {Automatic, 40}] and PlotLegends -:>PointLegend[...., Options[PointLegend]] – kglr Sep 17 at 9:10

Your Answer

 
discard

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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