comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: Widget_draw coordinates?
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: Widget_draw coordinates? [message #44948] Fri, 29 July 2005 10:21 Go to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
b_efremova@yahoo.com writes:

> Can somebody tell me how can I obtain x and y coordinates in data
> units, when using the widget_draw.
> The events have X and Y fields, but their values are only in pixels
> or inches, and I don't see an option for them to be in the data
> coordinate units.

c = Convert_Coord(event.x, event.y, /Device, /To_Data)
x = c[0,0]
y = c[1,0]

Just be sure you *have* a data coordinate system established
when you do the conversion! Typically, you save !X, and !Y
from a PLOT command and restore them before the conversion
takes place. Or, this occurs just after a PLOT, CONTOUR,
SURFACE, etc.

!X = info.bang_x
!Y = info.bang_y
c = Convert_Coord(event.x, event.y, /Device, /To_Data)
x = c[0,0]
y = c[1,0]

Cheers,

David

--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Re: Widget_draw coordinates? [message #45096 is a reply to message #44948] Fri, 29 July 2005 11:01 Go to previous message
b_efremova@yahoo.com is currently offline  b_efremova@yahoo.com
Messages: 18
Registered: July 2005
Junior Member
Thanks!
Actually, what I'm trying to write is that your ZPLOT does.
So, now I can see how humble my attempt is. Thanks for that too....!
Re: Widget_draw coordinates? [message #45097 is a reply to message #44948] Fri, 29 July 2005 10:42 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
David Fanning writes:

> Just be sure you *have* a data coordinate system established
> when you do the conversion! Typically, you save !X, and !Y
> from a PLOT command and restore them before the conversion
> takes place. Or, this occurs just after a PLOT, CONTOUR,
> SURFACE, etc.

See ZPLOT for an example of how this is done, if you
don't understand how to set up a data coordinate system:

http://www.dfanning.com/programs/zplot.pro

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Widget_draw coordinates?
Next Topic: Re: memory leak with HDF5?

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 19:13:25 PDT 2025

Total time taken to generate the page: 0.00697 seconds