I have multiple subplots in a figure. I also have the handle to one of the subplots, which I got through use of the ginputax function described here.
I now want to get the (integer) subplot index from the handle, so I can plot to the subplot using the subplot command.
[~, ~, ~, subplot_handle] = ginputax(1);
subplot_idx = ?function?( subplot_handle) %# this is the bit I don't know how to do
subplot(u, v, subplot_idx);
plot(x, y);
Is there an easy way to get this index? I realise I could alternatively plot directly to the subplot handle, but I would prefer to get the index out.
If you already have a handle to the subplot, you can use
subplot(subplot_handle)to plot in an existing subplot.