2
$\begingroup$

I am trying to place the legend box using epilog function. I'm unsure where I can specify the coordinated in the sample code to specify the position.

Show[Plotww, Plotxx, Plotyy, Plotzz,
     Epilog -> 
      Inset[Framed[
        LineLegend[{Red, Blue, Gray, Green}, {"ww", "xx", 
          "yy", "zz"}]]]]
$\endgroup$
2
$\begingroup$

You can use the second argument of Inset to specify the position:

pos = {4, .5};
{plotxx, plotyy, plotww, plotzz} = {Plot[Sin[x], {x, 0, 2 Pi}, PlotStyle -> Red], 
   Plot[Cos[x], {x, 0, 2 Pi}, PlotStyle -> Blue], 
   Plot[ Cos[2 x], {x, 0, 2 Pi}, PlotStyle -> Gray], 
   Plot[ Sin[ 2 x], {x, 0, 2 Pi}, PlotStyle -> Green]};

Show[plotxx, plotyy, plotww, plotzz, 
 Epilog -> Inset[Framed[LineLegend[{Red, Blue, Gray, Green}, {"ww", "xx", "yy", "zz"}]], 
    pos]]

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.