determining number of axes on a figure

15 次查看(过去 30 天)
how can I determine the number of axes that a figure has?
using get(figure,'Children') works but also gives data on non-axis children, which I don't want

回答(2 个)

Walter Roberson
Walter Roberson 2012-4-10
Do you only want axes that are immediate children, or do you want all axes, even those that might be several objects down (such as within uipanel) ? And how about if the handles are hidden, do you want them returned or not?
Immediate children only:
findobj( get(gcf,'Children'), '-depth', 1, 'type', 'axes')
All children (including hidden) at all levels:
findall(gcf, 'type', 'axes')
  5 个评论
Massimo Ciacci
Massimo Ciacci 2021-11-16
Awesome tip, didn't know about '-depth'. Works a charm.

请先登录,再进行评论。


Daniel Shub
Daniel Shub 2012-4-10
findobj(gcf, 'type', 'axes')

类别

Help CenterFile Exchange 中查找有关 Graphics Object Properties 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by