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 -> 
        LineLegend[{Red, Blue, Gray, Green}, {"ww", "xx", 
          "yy", "zz"}]]]]

1 Answer 1


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"}]], 

enter image description here


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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