From: luke on
Hello,

I'm using this

pt = get(gca,'CurrentPoint')

in order to sample the image I'm displaying on a specific axis of my
figure. This displays the x,y coordinates on the image correcty, but
the coordinates that are returned are not correct. It is as if they
are in different units or a different frame of reference .... I can't
figure it out.

How can I access the right coordinates that I'm displaying on the
figure?

thanks a lot!

-L
From: someone on
luke <ernandeth(a)gmail.com> wrote in message <675994fe-9849-4497-ac95-b84eed73b8a8(a)w30g2000yqw.googlegroups.com>...
> Hello,
>
> I'm using this
>
> pt = get(gca,'CurrentPoint')
>
> in order to sample the image I'm displaying on a specific axis of my
> figure. This displays the x,y coordinates on the image correcty, but
> the coordinates that are returned are not correct.

The above sentence seems to be a contradiction:
it displays the points correctly, yet it is incorrect
What does that statement mean?

In any case, the help for the CurrentPoint option states:

CurrentPoint
2-by-3 matrixLocation of last button click, in axes data units.
A 2-by-3 matrix containing the coordinates of two points defined by the location
of the pointer when the mouse was last clicked. MATLAB returns the coordinates
with respect to the requested axes.


It is as if they
> are in different units or a different frame of reference .... I can't
> figure it out.
>

So, the frame of reference is the axes units.

> How can I access the right coordinates that I'm displaying on the
> figure?
>
> thanks a lot!
>
> -L
From: luke on
On Jul 20, 10:16 am, "someone" <some...(a)somewhere.net> wrote:
> luke <ernand...(a)gmail.com> wrote in message <675994fe-9849-4497-ac95-b84eed73b...(a)w30g2000yqw.googlegroups.com>...
> > Hello,
>
> > I'm using this
>
> > pt = get(gca,'CurrentPoint')
>
> > in order to sample the image I'm displaying on a specific axis of my
> > figure.  This displays the x,y coordinates on the image correcty, but
> > the coordinates that are returned are not correct.
>
> The above sentence seems to be a contradiction:
> it displays the points correctly, yet it is incorrect
> What does that statement mean?
>
> In any case, the help for the CurrentPoint option states:
>
> CurrentPoint
> 2-by-3 matrixLocation of last button click, in axes data units.
> A 2-by-3 matrix containing the coordinates of two points defined by the location
> of the pointer when the mouse was last clicked. MATLAB returns the coordinates
> with respect to the requested axes.
>
>  It is as if they
>
> > are in different units or a different frame of reference ....  I can't
> > figure it out.
>
> So, the frame of reference is the axes units.
>
>
>
> > How can I access the right coordinates that I'm displaying on the
> > figure?
>
> > thanks a lot!
>
> > -L

thanks for the reply.

what I mean is that the values in the variable "pt" do not agree with
the little text box with the coordinates that matlab puts on the image
when I call the function. For example, when I click on a point, I'll
get a textbox on the image with x:219 Y:103 ,
but when I display pt, I get

-134.456 27.429 1.000
-134.456 27.429 0

Does that make more sense? The documentation seems to be failing me.

-L
From: someone on
luke <ernandeth(a)gmail.com> wrote in message <e40b3f1f-3a0f-4a7b-be73-b588476c6e9d(a)g19g2000yqc.googlegroups.com>...
> On Jul 20, 10:16 am, "someone" <some...(a)somewhere.net> wrote:
> > luke <ernand...(a)gmail.com> wrote in message <675994fe-9849-4497-ac95-b84eed73b...(a)w30g2000yqw.googlegroups.com>...
> > > Hello,
> >
> > > I'm using this
> >
> > > pt = get(gca,'CurrentPoint')
> >
> > > in order to sample the image I'm displaying on a specific axis of my
> > > figure.  This displays the x,y coordinates on the image correcty, but
> > > the coordinates that are returned are not correct.
> >
> > The above sentence seems to be a contradiction:
> > it displays the points correctly, yet it is incorrect
> > What does that statement mean?
> >
> > In any case, the help for the CurrentPoint option states:
> >
> > CurrentPoint
> > 2-by-3 matrixLocation of last button click, in axes data units.
> > A 2-by-3 matrix containing the coordinates of two points defined by the location
> > of the pointer when the mouse was last clicked. MATLAB returns the coordinates
> > with respect to the requested axes.
> >
> >  It is as if they
> >
> > > are in different units or a different frame of reference ....  I can't
> > > figure it out.
> >
> > So, the frame of reference is the axes units.
> >
> >
> >
> > > How can I access the right coordinates that I'm displaying on the
> > > figure?
> >
> > > thanks a lot!
> >
> > > -L
>
> thanks for the reply.
>
> what I mean is that the values in the variable "pt" do not agree with
> the little text box with the coordinates that matlab puts on the image
> when I call the function. For example, when I click on a point, I'll
> get a textbox on the image with x:219 Y:103 ,
> but when I display pt, I get
>
> -134.456 27.429 1.000
> -134.456 27.429 0
>
> Does that make more sense? The documentation seems to be failing me.
>
> -L

The axes Units property is set to 'normalized' by default.
That is probably what you are seeing.

From the Axes Properties help:

Note:
The Units property controls the positioning of
the axes within the figure. This property does not affect the data units used
for graphing. See the axes XLim, YLim, and ZLim properties
to set the limits of each axis data units.

So, I would set the XLim & YLim properties to align with your image.
From: luke on
On Jul 20, 10:41 am, "someone" <some...(a)somewhere.net> wrote:
> luke <ernand...(a)gmail.com> wrote in message <e40b3f1f-3a0f-4a7b-be73-b588476c6...(a)g19g2000yqc.googlegroups.com>...
> > On Jul 20, 10:16 am, "someone" <some...(a)somewhere.net> wrote:
> > > luke <ernand...(a)gmail.com> wrote in message <675994fe-9849-4497-ac95-b84eed73b...(a)w30g2000yqw.googlegroups.com>...
> > > > Hello,
>
> > > > I'm using this
>
> > > > pt = get(gca,'CurrentPoint')
>
> > > > in order to sample the image I'm displaying on a specific axis of my
> > > > figure.  This displays the x,y coordinates on the image correcty, but
> > > > the coordinates that are returned are not correct.
>
> > > The above sentence seems to be a contradiction:
> > > it displays the points correctly, yet it is incorrect
> > > What does that statement mean?
>
> > > In any case, the help for the CurrentPoint option states:
>
> > > CurrentPoint
> > > 2-by-3 matrixLocation of last button click, in axes data units.
> > > A 2-by-3 matrix containing the coordinates of two points defined by the location
> > > of the pointer when the mouse was last clicked. MATLAB returns the coordinates
> > > with respect to the requested axes.
>
> > >  It is as if they
>
> > > > are in different units or a different frame of reference ....  I can't
> > > > figure it out.
>
> > > So, the frame of reference is the axes units.
>
> > > > How can I access the right coordinates that I'm displaying on the
> > > > figure?
>
> > > > thanks a lot!
>
> > > > -L
>
> > thanks for the reply.
>
> > what I mean is that the values in the variable "pt" do not agree with
> > the little text box with the coordinates that matlab puts on the image
> > when  I call the function.  For example, when I click on a point, I'll
> > get a textbox on the image with x:219 Y:103 ,
> > but when I display pt, I get
>
> > -134.456  27.429   1.000
> > -134.456  27.429    0
>
> > Does that make more sense?  The documentation seems to be failing me.
>
> > -L
>
> The axes Units property is set to 'normalized' by default.
> That is probably what you are seeing.
>
> From the Axes Properties help:
>
> Note:
> The Units property controls the positioning of
> the axes within the figure. This property does not affect the data units used
> for graphing. See the axes XLim, YLim, and ZLim properties
> to set the limits of each axis data units.
>
> So, I would set the XLim & YLim properties to align with your image.

Thanks again, someone.

I checked for the XLim and XLimMode properties, they are set to [0
300] and 'Auto'. I just really don't get why the x-coordinate on that
axis should ever be negative. This is pretty frustrating...

But....Since matlab is reporting the coordinates correctly on the
"floating textbox" on the figure, do you know a way to access the
context of that box (without using the interactive GUI stuff) ?

-L