How to identify what element a handle belongs to

1 view (last 30 days)
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
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.)
Adam Danz
Adam Danz on 8 Jun 2014
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).

Sign in to comment.

Answers (1)

Image Analyst
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
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?
Adam Danz
Adam Danz on 9 Jun 2014
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).

Sign in to comment.

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!