1
$\begingroup$

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

$\endgroup$
3
  • 1
    $\begingroup$ What version of Mathematica are you using? Are you using the old PlotLegends` package? $\endgroup$
    – rcollyer
    Feb 7, 2013 at 15:50
  • $\begingroup$ I am using 9 version, and I just did as it was shown in tutrial.I guess I am using a legend package $\endgroup$
    – Misery
    Feb 7, 2013 at 15:51
  • 2
    $\begingroup$ That explains a lot. Try looking at the new legends functionality. $\endgroup$
    – rcollyer
    Feb 7, 2013 at 17:17

1 Answer 1

5
$\begingroup$

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.

$\endgroup$
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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