How do I set tooltip strings on scatter children?
Mostrar comentarios más antiguos
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 comentario
David O
el 8 de Jun. de 2011
Respuesta aceptada
Más respuestas (2)
Walter Roberson
el 8 de Jun. de 2011
0 votos
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
el 8 de Jun. de 2011
0 votos
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....
Categorías
Más información sobre App Building en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!