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

Home » Public Forums » archive » Re: Plotting Vectors/Rays
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: Plotting Vectors/Rays [message #10043 is a reply to message #10034] Mon, 06 October 1997 00:00 Go to previous messageGo to previous message
Robert.M.Candey is currently offline  Robert.M.Candey
Messages: 23
Registered: June 1995
Junior Member
In article <34392838.41C6@phy.ornl.gov>, William Raphael Hix
<raph@phy.ornl.gov> wrote:

> Hi-
>
> I think I need to follow-up. First and foremost, thanks for all the
> help.
> However the advice given doesn't completely solve my problems, as I'll
> explain below.
>
> David Fanning wrote:
>>
>> Raph writes:
>>
>>> First, I can't figure out how to make the X and Y axes have the same
>>> unit length, so that, for example a 45 deg angle is actually 45 degrees
>>> on the display, not simply a slope of 1.
>> . . .

I'm sure there is a better way to do this but here is my routine;
unfortunately it creates a blank plot first to get the right data ranges.
It would really be useful to have a standard /isotropic keyword like for
map_set. I haven't tested it with IDL 5 yet.

pro even_scale, x, y
; CREATE EVEN (exact) SCALE frame with equal data units plotting as equal
; distances on the X and Y axes
; This is extracted from Plot_even.pro created by
; Bobby Candey, Atlantic Research Corp. 1991 April 11; S. F. Fung 9/10/91.
; now Robert.M.Candey@gsfc.nasa.gov
; alters !p.position and !p.multi and !x/y.range and makes a dummy plot
!p.position = 0
!p.multi = 0 ; reset to 1 plot per page
if (n_params(0) eq 2) then begin
!x.range = [min(x), max(x)]
!y.range = [min(y), max(y)]
endif
plot,[0,1],[0,1] ; dummy plot to set !x/y.crange and !x/y.window
device,/close
wx = !x.window & wy = !y.window ; window size in normalized coordinates
xr = !x.crange(1) - !x.crange(0) ; data range in data coordinates
yr = !y.crange(1) - !y.crange(0)
xdevice = wx * float(!d.x_size) ; current window in pixels
ydevice = wy * float(!d.y_size)
xrdevice = xdevice(1) - xdevice(0) ; current window width in pixels
yrdevice = ydevice(1) - ydevice(0)
xratio = xr / xrdevice ; data units per pixel
yratio = yr / yrdevice
ratio = max([xratio, yratio])
newxmaxnorm = (xr / ratio + xdevice(0)) / float(!d.x_size)
newymaxnorm = (yr / ratio + ydevice(0)) / float(!d.y_size)
!p.position = [wx(0), wy(0), newxmaxnorm, newymaxnorm]
return
end

--
Robert.M.Candey@gsfc.nasa.gov
NASA Goddard Space Flight Center, Code 632
Greenbelt, MD 20771 USA 1-301-286-6707
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: typesetting math in IDL plots
Next Topic: Re: ftp.dfanning.com

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

Current Time: Sat Oct 11 18:43:16 PDT 2025

Total time taken to generate the page: 0.55990 seconds