Consider the following example
f = figure(1);
ax(1) = subplot(2,1,1);
plot(1:100,randi(50,1,100));
ax(2) = subplot(2,1,2);
plot(1:100,randi(50,1,100))
[x, ~] = ginput(2);
clickedAx = gca
Is there anyway I can the subplot number on which i clicked for ginput from the axes handle properties ? or some other way ?