getting the axis position correctly
显示 更早的评论
I can get the position of the axis easily
figure,plot([0 1], [0 1])
axis equal
AxesHandle=findobj(gcf,'Type','axes');
get(AxesHandle,'Position')
However when I modify the axis limits the axis position does not update.
axis tight
get(AxesHandle,'Position')
still gives me the same answer. How do I get the correct axis position in the second case?
采纳的回答
更多回答(2 个)
Kelly Kearney
2011-4-20
8 个投票
I wrote a little function that analyzes the aspect ratios and calculates the plotted axis region:
Should return exactly what you're looking for.
2 个评论
dk
2011-4-20
Yujendra Mitikiri
2021-10-23
编辑:Yujendra Mitikiri
2021-10-23
Thank you! This is exactly what I needed, in order to add annotations after making "axis equal."
Paulo Silva
2011-4-20
The position remains the same, don't believe me? go to Tools and press Edit Plot, now click on the axis :)
One thing that do change is the:
xlim
类别
在 帮助中心 和 File Exchange 中查找有关 Axis Labels 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!