source: trunk/SRC/ToBeReviewed/PLOTS/DIVERS/autoscale.pro @ 325

Last change on this file since 325 was 325, checked in by pinsard, 16 years ago

modification of some headers (+some corrections) to prepare usage of the new idldoc

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 1.4 KB
Line 
1;+
2;
3; @file_comments
4; We give a min and a max, and the procedure send back
5; the good contour interval and labels's value.
6;
7; @categories
8; Graphics
9;
10; @param MIN {in}{required} {type=float}
11; above what value we want to trace a contour
12;
13; @param MAX {in}{required} {type=float}
14; below what value we want to trace a contour
15;
16; @param CI {out} {type=real}
17; the contour interval. Use it in <proidl>CONTOUR</proidl> with the
18; keyword LEVEL.
19;
20; @restrictions
21; CI is a multiple of the unity in unity log of 10.
22; It force the number of contours to be even.
23;
24; @history
25; G. Roullet / aout 99 (gr\@lodyc.jussieu.fr)
26;
27; @version
28; $Id$
29;
30;-
31PRO autoscale, min, max, ci
32;
33  compile_opt idl2, strictarrsubs
34;
35; Estimation of a first CI, notice the presence of the floor (Inferior round)
36; This CI is a multiple of the unity in unity log of 10.
37    ci = (max-min)/20.
38    ci = 10.^floor(alog10(ci))
39
40    n = 0
41    ci0 = ci
42;
43    coef = [2, 2.5, 5, 10]
44;
45; We test differents CI (contour intervals), i.e. 1, 2, 2.5, 5 and 10
46; until the number of contour is inferior to 30.
47;
48    WHILE ceil((max-min)/ci) GE 30 DO BEGIN
49          ci = ci0*coef[n]
50          n = n+1
51    ENDWHILE
52
53    min = floor(min/ci/2)*ci*2
54    max = ceil(max/ci/2)*ci*2
55
56    nlevels = round((max-min)/ci)
57
58;
59;  We force the number of contour to be even
60;
61    IF nlevels MOD 2 EQ 1 THEN BEGIN
62          nlevels = nlevels+1
63          max = max+ci
64    END
65END
Note: See TracBrowser for help on using the repository browser.