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 
Return to the default flat view Create a new topic Submit Reply
Re: Widget_draw coordinates? [message #44948] Fri, 29 July 2005 10:21 Go to previous 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/
[Message index]
 
Read Message
Read Message
Read Message
Previous Topic: Widget_draw coordinates?
Next Topic: Re: memory leak with HDF5?

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

Current Time: Thu Oct 09 14:53:26 PDT 2025

Total time taken to generate the page: 1.27987 seconds