1

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.

John Taylor
  • 5,701
  • 2
  • 12
  • 33

2 Answers2

2

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

Sumit
  • 15,912
  • 2
  • 31
  • 73
1

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