ax = axes('ButtonDownFcn', @(varargin) disp('hi'));
Click on the axes. MATLAB will display hi in the Command Window.
Now add a line to the axes.
If you click on the axes but not the line you will still see hi displayed. If you click on (or close enough to) the line you will not see anything new displayed in the Command Window.
Now tell MATLAB to ignore the line when it's determining what you clicked on.
After running that command clicking on the axes and clicking on or near the line will display hi.