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

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

replace some print by some report in some .pro (continuation) + 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} {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;-
31;
32PRO autoscale, min, max, ci
33;
34  compile_opt idl2, strictarrsubs
35;
36; Estimation of a first CI, notice the presence of the floor (Inferior round)
37; This CI is a multiple of the unity in unity log of 10.
38    ci = (max-min)/20.
39    ci = 10.^floor(alog10(ci))
40
41    n = 0
42    ci0 = ci
43;
44    coef = [2, 2.5, 5, 10]
45;
46; We test differents CI (contour intervals), i.e. 1, 2, 2.5, 5 and 10
47; until the number of contour is inferior to 30.
48;
49    WHILE ceil((max-min)/ci) GE 30 DO BEGIN
50          ci = ci0*coef[n]
51          n = n+1
52    ENDWHILE
53
54    min = floor(min/ci/2)*ci*2
55    max = ceil(max/ci/2)*ci*2
56
57    nlevels = round((max-min)/ci)
58
59;
60;  We force the number of contour to be even
61;
62    IF nlevels MOD 2 EQ 1 THEN BEGIN
63          nlevels = nlevels+1
64          max = max+ci
65    END
66END
Note: See TracBrowser for help on using the repository browser.