Adding a label with text on a plot
2 views (last 30 days)
Show older comments
I have a plot of some data and I want to highlight one of its distinct peaks like this:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1630126/image.png)
Is there any way that I can do this?
0 Comments
Accepted Answer
Chunru
on 28 Feb 2024
x = -3:.1:3
y = exp(-(x-0.5).^2/2);
plot(x, y)
% need to adjust the coordinates (normalized unit)
% doc annotation for more details
annotation("doublearrow", [0.58 0.58], [0.12 0.93]);
text(0.5, 0.4, "a", "Color", "r") % data unit
0 Comments
More Answers (0)
See Also
Categories
Find more on 2-D and 3-D Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!