Yes, this is possible to do, but it is complicated. When you place graphics in a figure window, they are located based on the figure window axes. But you want to position this relative to a set of axes in the figure window, so you have to compute the position in the axes relative to the figure window axes.
The axis system attached to the figure window is in "normalized" units. [0, 0] is the lower left corner of the figure window, and [1, 1] is the upper right corner of the figure window. Note that this does not include the title banner or the tool bar on top of the figure window.
In order to manipulate the figure, you need to have it's handle. The easiest way is to get the handle when you create the new figure window;
This command creates a new, empty figure window, and returns it's handle, h.
Or, you can get the handle of the curent figure using:
The command "gcf" returns the handle to the current figure.
You will also ned the handle to your plot axes. You get this in a similar way:
After creating your plot, gca returns the handle to the current axes.
Now you can find out the position of the axes inside the figure window:
AxesPos = get(ax, 'position');
"AxesPos" contains 4 values: AxesPos(1:4) = left position, bottom position, Axes width, Axes height. (see the first figure, above). I'll name these [Ax_xpos, Ax_ypos, Ax_width, Ax_height]
By default, these are in normalized units, so their values are all between zero and 1.
You get the axes scales using:
xscale = get(ax, 'xlim' );
yscale = get(ax, 'ylim');
xscale contains [xmin, xmax], and yscale contains [ymin, ymax]. These are in axes units, i.e. the units that pertain to your data which are displayed in the axis labels. Now compute the position of the axes scales in terms of normalized figure window units:
X_norm, Y_norm are the normalized coordinates for point X, Y in axes units. The inverse calculation converts coordinates from normalized coordinates to axes units;
X_scale, Y_scale are the plot axes coordinates for point X, Y in normalixed units.
So, this is how you get from figure window axes to plot axes and vice-versa.
Now, you can use this to position your text box.