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.

I am trying to make a legend for my plot. Actually, I made one, but I cannot understand why there are such big spaces between the legend positions.

Graphics[Legend[{
   {Graphics[{CapForm[None], Red, Thickness -> 0.05, 
      Line[{{0, 1}, {1, 1}}]}], "A"},
   {Graphics[{CapForm[None], Blue, Thickness -> 0.05, 
      Line[{{0, 1}, {1, 1}}]}], "B"},
   {Graphics[{CapForm[None], Green, Thickness -> 0.1, 
      Line[{{0, 1}, {1, 1}}]}], "C"}
   }, LegendTextSpace -> 0.25]]

Results in:

wrong legend

share|improve this question
1  
What version of Mathematica are you using? Are you using the old PlotLegends` package? –  rcollyer Feb 7 '13 at 15:50
    
I am using 9 version, and I just did as it was shown in tutrial.I guess I am using a legend package –  Misery Feb 7 '13 at 15:51
2  
That explains a lot. Try looking at the new legends functionality. –  rcollyer Feb 7 '13 at 17:17
add comment

1 Answer

up vote 5 down vote accepted

I think this does it:

Graphics[Legend[{{Graphics[{CapForm[None], Red, Thickness -> 0.05, 
      Line[{{0, 1}, {1, 1}}]}], 
    "A"}, {Graphics[{CapForm[None], Blue, Thickness -> 0.05, 
      Line[{{0, 1}, {1, 1}}]}], 
    "B"}, {Graphics[{CapForm[None], Green, Thickness -> 0.1, 
      Line[{{0, 1}, {1, 1}}]}], "C"}}], ImageSize -> 50]

enter image description here

ImageSize -> ## does the trick.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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