How to identify what element a handle belongs to
1 view (last 30 days)
Show older comments
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 Comments
Star Strider
on 8 Jun 2014
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.)
Answers (1)
Image Analyst
on 8 Jun 2014
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 Comments
Image Analyst
on 8 Jun 2014
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?
See Also
Categories
Find more on Labels and Annotations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!