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.
Mathematica Stack Exchange is a question and answer site for users of Wolfram Mathematica. It only takes a minute to sign up.
Sign up to join this communityConsider 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.
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}]}]
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}]