关于annotation object的旋转

今天一同学在Matlab群里问如何将annotation object进行旋转,虽然我在写论文很忙,但是这种牛角尖的问题我就喜欢去钻研偷笑,于是google,baidu都用上,结果都没找到合理的答案,最后还是在matlab的doc文档里面找到了答案,下面贴出代码


ax = axes('XLim',[-2 1],'YLim',[-2 1],'ZLim',[-1 1]);
t1 = hgtransform('parent',ax);
view(3)
h = annotation('rectangle',[0.3 0.3 0.5 0.5],'FaceColor',[1 1 0]);
set(h,'Parent',t1)
for r = 1:.1:10*pi
    % Form z-axis rotation matrix 
    Rz = makehgtform('zrotate',r);
   
  % Set transforms for both groups
    set(t1,'Matrix',Rz)
    pause(0.1);
    drawnow
end


你可能感兴趣的:(关于annotation object的旋转)