Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

This question already has an answer here:

I have this graph:

ShowLegend[
Plot[Sin[x], {x, 0, 10}, Filling -> Axis, FillingStyle -> {Red, Blue}], 
{{{Graphics[{Blue, Disk[{0, 0}, 1]}, ImageSize -> 5], Sin[x] > 0}, {Graphics[{Red, Disk[{0, 0}, 1]}], Sin[x] < 0}}}]

enter image description here

and I would like to change the size of the disks in the legend. Unfortunately, using the ImageSize option doesn't work Graphics[{Red, Disk[{0, 0}, 1]},ImageSize -> 2]

What should I do in this case?

share|improve this question

marked as duplicate by Öskå, bobthechemist, RunnyKine, Jens, m_goldberg Jul 29 at 23:22

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

    
What version are you using? –  Öskå Jul 29 at 16:14
    
@Öskå version 9, although I might migrate to version 10 very soon, especially if you tell me it's easier to do so in version 10 –  su1 Jul 29 at 16:20
    
What I was about to tell you is that Needs["PlotLegends`"] is obsolete, the Plot option PlotLegends should be used now. –  Öskå Jul 29 at 16:22
    
@Öskå Mathematica 9 told me it was obsolete, but it still seems to work, and I've seen many people on Stackexchange who don't recommend using PlotLegends? Was it before and now it works well? –  su1 Jul 29 at 16:27
    
You may have seen many people who don't recommend using PlotLegend but PlotLegends instead :) Since v9 PlotLegend has been replaced by PlotLegends and it works pretty fine I think :) –  Öskå Jul 29 at 16:40

1 Answer 1

Just change the value of LegendMarkerSize to the size that you want. Look more into PlotLegends and SwatchLegend in the documentation.

Plot[Sin[x], {x, 0, 10}, Filling -> Axis, FillingStyle -> {Red, Blue},
  PlotLegends -> 
  SwatchLegend[{Blue, Red}, {"Sin(x) > 0", "Sin(x) < 0"}, 
   LegendMarkers -> Graphics[Disk[]], LegendMarkerSize -> 20, 
   LegendFunction -> Framed]]

Mathematica graphics

share|improve this answer

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