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

Last change on this file since 231 was 231, checked in by pinsard, 17 years ago

improvements/corrections of some *.pro headers

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