Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Make the data tip ignore superimposed plot data

Asked by Matt J on 1 Feb 2013

I have a code routine that displays an image in a figure window and also superimposes a scatter plot onto that image. When the data tip tool is clicked on a pixel too close to one of the plot points (even not directly on it) the data tip will try to process a nearby plot point instead of the image pixel directly under it. Zooming does not help.

Is there a way that I can make the data tip ignore the presence of the plot data?

0 Comments

Matt J

Products

No products are associated with this question.

1 Answer

Answer by Tom Lane on 1 Feb 2013
Accepted answer

If h is a handle to the plot line, I'd expect set(h,'HitTest','off') to do what you want. Not 100% sure, but give it a try.

3 Comments

Matt J on 1 Feb 2013

That's great. But for some reason it seems to work for scatter plot data but not for other kinds of superimposed objects like imellipses. Any idea why?

Sean de Wolski on 1 Feb 2013

Matt: I would imagine you would have to get the children of the imellipse() (or imroi() for other ones) and set their 'HitTest' to off.

h = imellipse;
hC = get(h,'children')
get(hC(1)) %etc.
Matt J on 8 Feb 2013

Thanks Sean. Actually, it appears you have to turn off the 'HitTest' both of the imellipse handle and the children hC. Otherwise, the interior of the ellipse will be opaque to the data tip and no pixels inside the ellipse can be probed.

Tom Lane

Contact us