4
$\begingroup$

Here is a simple version of my actual problem where I want to label curves inside Show and indicate the labelling by a legend.

 p1 = Plot[Sin[x], {x, 0, 2 \[Pi]}];
p2 = Plot[Exp[-x] Sin[2 x], {x, 0, 2 \[Pi]}];
Show[p2, p1, PlotRange -> All, Frame -> True, 
 FrameLabel -> {"x", "functions"}]

I have edited the resulting plot in powerpoint to show what I want it to look like. How can one make such changes inside Show? enter image description here

$\endgroup$

1 Answer 1

7
$\begingroup$
Clear["Global`*"]

Using a single Plot

Plot[{Sin[x], Exp[-x] Sin[2 x]},
 {x, 0, 2 π},
 PlotRange -> {-1.1, 1.1},
 Frame -> True,
 FrameLabel -> {"x", "functions"},
 Epilog -> {
   Text[Style[Subscript[A, "\[TensorProduct]"], 14], {1.6, 0.9}],
   Text[Style[Subscript[A, "⊕"], 14], {0.9, 0.2}],
   Text[
    Framed[
     StringForm["`` = Tensor Prod\n`` = Tensor Sum",
      Style["\[TensorProduct]", ColorData[97][1]],
      Style["⊕", ColorData[97][2]]],
     FrameStyle -> Directive[Gray, Thin]],
    {5, .7}]}]

enter image description here

Using Show

p1 = Plot[Sin[x], {x, 0, 2 π}];
p2 = Plot[Exp[-x] Sin[2 x], {x, 0, 2 π},
   PlotStyle -> ColorData[97][2]];
Show[p2, p1,
 Graphics[{
   Text[Style[Subscript[A, "\[TensorProduct]"], 14], {1.6, 0.9}],
   Text[Style[Subscript[A, "⊕"], 14], {0.9, 0.2}],
   Text[
    Framed[
     StringForm["`` = Tensor Prod\n`` = Tensor Sum",
      Style["\[TensorProduct]", ColorData[97][1]],
      Style["⊕", ColorData[97][2]]],
     FrameStyle -> Directive[Gray, Thin]],
    {5, .7}]}],
 PlotRange -> All,
 Frame -> True,
 FrameLabel -> {"x", "functions"}]

enter image description here

$\endgroup$
0

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.