1
$\begingroup$

Given the following plot

Plot[{Sin[x],Cos[x]},{x,0,2\[Pi]},Epilog->Inset[Framed[LineLegend[{Directive[Black],Directive[Red,Dashed]},{"Phase=1, BG=A","Phase=2, BG=O"}],RoundingRadius->5],Scaled[{0.625,0.3}]]]

How can we make the legend size smaller?

$\endgroup$
  • 1
    $\begingroup$ does size=.2; Plot[{Sin[x], Cos[x]}, {x, 0, 2 \[Pi]}, Epilog -> Inset[Rasterize[ Framed[LineLegend[{Directive[Black], Directive[Red, Dashed]}, {"Phase=1, BG=A", "Phase=2, BG=O"}], RoundingRadius -> 5], RasterSize -> 500], Scaled[{0.625, 0.3}], {0.5, 0.5}, Scaled[size]]] work in your version/OS? $\endgroup$ – kglr May 24 at 12:59
  • $\begingroup$ It does. Thank you @kglr. $\endgroup$ – H. Kenan May 24 at 17:06
3
$\begingroup$

You can Rasterize the first argument of Inset and use the fourth argument to set the size:

size = .3;
Plot[{Sin[x], Cos[x]}, {x, 0, 2 \[Pi]}, 
  Epilog -> Inset[Rasterize[Framed[LineLegend[{Directive[Black], Directive[Red, Dashed]}, 
       {"Phase=1, BG=A", "Phase=2, BG=O"}], RoundingRadius -> 5], 
    RasterSize -> 500], Scaled[{0.625, 0.3}], {0.5, 0.5}, Scaled[size]]]

enter image description here

$\endgroup$

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.