How to identify what element a handle belongs to

1 次查看(过去 30 天)
I have a vector of handles. Now I'd like to know exactly what handle belongs to what element of the plot.
As a working example,
p = polar ((pi/180) .* [0:45:360], [25 5 25 5 25 5 25 5 25]);
t = findall(gca,'type','text')
h = findall(gca,'type','line')
From 't', i'd like to know which handles belong to the which text elements of the plot. Note that there are more element (length(t) = 20) than x or y labels (I count 17).
From 'h', i'd like to know which handles belong to which elements of the plot. length(h) = 12.
(Matlab R2014a)
  2 个评论
Star Strider
Star Strider 2014-6-8
The only problem is that polar is significantly (notoriously) resistant to any modification of most of its properties. It’s not at all like most other graphics objects.
------------------------
I can’t resist commenting on your MRI image. The corpus callosum and limbic tract seem to be abnormally dense. I don’t recall them as such in ‘healthy’ images. (I’m obviously not a Radiologist or Neurologist.)
Adam Danz
Adam Danz 2014-6-8
Thanks, that's what I've found as well. In fact, I wrote some code to adjust x-tick intervals (about the circumference) on pre-established polar plots.
I'm trying to improve it a bit but can't get over this hump of separating handles.
Thanks. About the MRI, it's mine. I'm not a radiologist either (studying electrophysiology).

请先登录,再进行评论。

回答(1 个)

Image Analyst
Image Analyst 2014-6-8
The tick mark labels probably also are text objects. Maybe one way is to just set each invisible or visible until you see which vanish or appear when you do that.
  3 个评论
Image Analyst
Image Analyst 2014-6-8
Of course if you added any text elements, you can get those by
hText = text(x,y, yourString);
But of course there are other "automatic" ones like tick marks. Why do you need to find a specific one?
Adam Danz
Adam Danz 2014-6-9
Currently I am finding all text elements via t = findall(handle,'type','text'); and then deleting them. I would like to only delete the tick marks. But this also deletes any other text elements such as title etc.
This code is applied to plots that already exist. Some may have titles, etc and some may not. By identifying the handles, I can selectively delete those that are xticks (for example) and save those that are titles (for example).

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Labels and Annotations 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by