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

Home » Public Forums » archive » Re: Looking for more elegant plot scaling...
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: Looking for more elegant plot scaling... [message #76650] Mon, 20 June 2011 03:12
Gray is currently offline  Gray
Messages: 253
Registered: February 2010
Senior Member
On Jun 19, 9:01 pm, Balt <bindermue...@gmail.com> wrote:
> Both very elegant and just what I was looking for, thanks guys!
>
> - Balt

There's also the MINMAX routine in the NASA IDL Astro library:

IDL> mnmxy = minmax([all,your,arrays])
IDL> oplot, thing, yra=mnmxy
Re: Looking for more elegant plot scaling... [message #76651 is a reply to message #76650] Sun, 19 June 2011 18:01 Go to previous message
Balt is currently offline  Balt
Messages: 16
Registered: May 2010
Junior Member
Both very elegant and just what I was looking for, thanks guys!

- Balt
Re: Looking for more elegant plot scaling... [message #76652 is a reply to message #76651] Sat, 18 June 2011 18:57 Go to previous message
ben.bighair is currently offline  ben.bighair
Messages: 221
Registered: April 2007
Senior Member
Hi,

On 6/18/11 1:16 AM, Balt wrote:
> Hi all,
>
> I'm OPLOTting 3 curves on a fourth one. Is there a more elegant way to
> scale a plot to YRANGE=[maxy,miny] than this:
>
> ; get the y max for the plots
> maxy = MAX(temp_obsdata)
> IF MAX(splined_wvrdata) GT maxy THEN maxy = MAX(splined_wvrdata)
> IF MAX(residuals) GT maxy THEN maxy = MAX(residuals)
> IF MAX(interp_obsdata) GT maxy THEN maxy = MAX(interp_obsdata)
>
> miny = MIN(temp_obsdata)
> IF MIN(splined_wvrdata) LT miny THEN miny = MIN(splined_wvrdata)
> IF MIN(residuals) LT miny THEN miny = MIN(residuals)
> IF MIN(interp_obsdata) LT miny THEN miny = MIN(interp_obsdata)
>
> Maybe something a bit more C macro-ish... ?

I don't know about C stuff, but IDL's compare-and-assign operators could
be handy here...

IDL> a = randomn(s,10)
IDL> b = randomn(s,10)
IDL> c = randomn(s,10)
IDL> print, a,b,c
0.774450 0.0338028 -2.49289 -0.430953 2.15833
0.868524 -0.145793 1.13590 0.726517 1.28041
-1.14027 -0.520221 -0.283700 -0.849713 0.00405929
-0.525046 -0.335924 -0.548919 1.01423 0.0764202
2.04586 0.00412738 1.72472 0.707579 0.997633
1.72583 0.913348 0.699497 1.20014 0.907764
IDL> maxy = max(a) > max(b) > max(c)
IDL> print, maxy
2.15833
IDL> maxy = max(a, min = mina) > max(b, min = minb) > max(c, min=minc)
IDL> print, mina,minb,minc
-2.49289 -1.14027 0.00412738
IDL> miny = mina < minb < minc
IDL> print, miny
-2.49289


You could also simply concatenate all of the arrays together, but that
seems like a lot of overhead.

Cheers,
Ben
Re: Looking for more elegant plot scaling... [message #76655 is a reply to message #76652] Sat, 18 June 2011 05:04 Go to previous message
wlandsman is currently offline  wlandsman
Messages: 743
Registered: June 2000
Senior Member
I'd probably go with the single line

maxy = max([temp_obsdata,splined_wvrdata,residuals,interp_obsdata], min=miny)

You could also use

maxy = max(temp_obsdata) > max(splined_wvrdata) > max(residuals) > max(interp_obsdata)
miny = min(temp_obsdata) < min(spline_wvrdata) < min(residuals) < min(interp_obsdata)

--Wayne
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Shapefile Opening Error
Next Topic: Object graphics and runtime mode

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

Current Time: Wed Oct 08 13:33:18 PDT 2025

Total time taken to generate the page: 0.00585 seconds