On 5/18/2013 9:19 AM, Stan24 wrote: > I've forgotten to add: > gname(1:10, h1); % returns the wrong handle
Don't understand what you need...gname() returns the handle of the text objects it makes; they _can't_ be "wrong" excepting you may be misunderstanding.
W/ your initial call to plot(),
h1 = plot(1:10, sin(1:10), 'o-');
gname(1:10, h1); puts up the cursor and labels the points on the line drawn there--don't know what else you want it should do???
h1 is the handle to the line object returned from plot() and so using as the argument to gname will label those points.
Even if I then use the second scatter() call, the h1 handle correctly identifies the line from the plot and internal logic requires being "close enough" to the points on the line that they're identified and labeled instead of the points of the scatter plot that are in the general neighborhood.
Looks like working as advertised to me. What are you really after?