How to add a specific value with arrow or a marker in the axis of a plot?
1 次查看(过去 30 天)
显示 更早的评论
I have a 2D plot. I plotted a curve and the average of the data in the same plot. I want to write the average value beside the Y-axis to indicate the average value. How to write it ?
4 个评论
Jan
2019-3-14
@Ritabrata Chakraborty: Is this a comment to my answer? Does my answer solve the problem?
采纳的回答
Jan
2019-3-13
x = rand(1, 10);
m = mean(x);
axes('XLim', [1, 10], 'NextPlot', 'add', 'Box', 'on');
plot(x, 'b');
yline(m, 'g');
text(10.01, m, 'Mean', ...
'Color', 'g', ...
'HorizontalAlignment', 'left', ...
'Units', 'data');
The creates the text slightly right from the axes.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Annotations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!