How to add a specific value with arrow or a marker in the axis of a plot?
3 ビュー (過去 30 日間)
古いコメントを表示
Ritabrata Chakraborty
2019 年 3 月 13 日
コメント済み: Ritabrata Chakraborty
2019 年 3 月 17 日
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!