1
$\begingroup$

Consider we want to add one point on the plot with some legend (see the question). How to add the separate legend for this point? How to add the legend for many points at the plot?

Thank you.

$\endgroup$
2
  • $\begingroup$ By legend, do you mean a text or a symbol? $\endgroup$
    – Sumit
    Commented Apr 18, 2018 at 7:12
  • $\begingroup$ @Sumit : a text. $\endgroup$ Commented Apr 18, 2018 at 7:29

2 Answers 2

2
$\begingroup$

You can use Epilog.

p1 = {Pi/2, 1}; txt1 = "Max";
p2 = {3 Pi/2, -1}; txt2 = "Min";
Plot[Sin[x], {x, 0, 2 Pi}, 
 Epilog -> {Point[p1], Text[txt1, p1 + {0, -0.1}], Point[p2], Text[txt2, p2 + {0, 0.1}]}]

enter image description here

$\endgroup$
1
$\begingroup$

From the documentation, this could be a starting point by using Callout:

Plot[{Callout[Log[x] Sin[x], "P1", {2, Log[2] Sin[2]}, 
LabelStyle -> Directive[Bold, Italic], FrameMargins -> 7, 
CalloutMarker -> "CirclePoint", Appearance -> "Leader"], 
Callout[Log[x] Sin[x], "P2", {5, Log[5] Sin[5]}, 
LabelStyle -> Directive[Bold, Italic], FrameMargins -> 7, 
CalloutMarker -> "CirclePoint", Appearance -> "Leader"]}, {x, 0, 
2 \[Pi]}, PlotRange -> {-2, 1}]

enter image description here

$\endgroup$

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.