How do I set tooltip strings on scatter children?
Ältere Kommentare anzeigen
Hello,
I am attempting to programmatically set the TooltipString property for all of the points in my scatter plot and so far have not quite gotten there.
My intention is something like:
h = scatter(xPts,yPts,'b+');
allPts = get(h,'Children');
for i=1:length(allPts)
set(allPts{i},'TooltipString',pointNames(i));
end
... where the first get() would return the list of handles to point objects that could have individual tooltips set to their point names. I am apparently not getting the object hierarchy correct and/or am on the wrong track entirely.
Is an example of this reasonably documented?
Thanks, david
1 Kommentar
David O
am 8 Jun. 2011
Akzeptierte Antwort
Weitere Antworten (2)
Walter Roberson
am 8 Jun. 2011
0 Stimmen
scatter() does not create individual point objects.
I do not know if it is possible to set tooltipstring strings for the individual points. The only approach I can think of at the moment is to create a datacursor object and set the callback function for it to figure out which point is involved and display the appropriate string.
Matt Fig
am 8 Jun. 2011
0 Stimmen
The children of the handle to h are patch objects, which have no tooltipstring. You could do something similar to what I did here, though it would take a more work because patches don't have a position property. So you would have to translate the xdata and ydata into positions relative to the figure....
Kategorien
Mehr zu App Building finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!