Showing data values on markers in figure
120 ビュー (過去 30 日間)
古いコメントを表示
When I run: x=0.4:3.6;
x1=[.4 1 1.4 2 2.4 3 3.6];
y1=[17.25 33.6 36.72 37.2 36.8 36.75 32.7];
plot(x1,y1,'Marker','square','MarkerIndices',1:7);
xlabel('RL');
ylabel('P');
this figure opens:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/170129/image.jpeg)
How can I change the code so that the values on markers appear?
0 件のコメント
回答 (1 件)
KL
2017 年 11 月 24 日
use text
something like
for t = 1:numel(x1)
text(x1(t)+0.1,y1(t)+0.1,['(',num2str(x1),',',num2str(y1),')'])
end
1 件のコメント
Juliette Koch
2021 年 6 月 18 日
編集済み: Juliette Koch
2021 年 6 月 18 日
I changed it into:
for t = 1:numel(x1)
text(x1(t)+0.1,y1(t)+0.1,['(',num2str(x1(t)),',',num2str(y1(t)),')'])
end
And it's perfect :)
参考
カテゴリ
Help Center および File Exchange で Annotations についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!