Matlab 如何实现图中标签的摆放位置

本文的内容来自matlab 官方博客。

s=load('sunspot.dat');
year = s(:,1);
spots = s(:,2);
bar(year,spots);
[smax,indmax]=max(spots);
yearmax=year(indmax);
hold on 
plot(yearmax,smax,'m*');
hold off
ht=text(yearmax, smax,[' ', int2str(round(smax)),'sunspots ']);


Matlab 如何实现图中标签的摆放位置_第1张图片Matlab 如何实现图中标签的摆放位置_第2张图片

 

 set(ht,'HorizontalAlignment','right','Rotation',45);


Matlab 如何实现图中标签的摆放位置_第3张图片

 

 

你可能感兴趣的:(Matlab 如何实现图中标签的摆放位置)