[2] | 1 | ;+ |
---|
| 2 | ; |
---|
[231] | 3 | ; @file_comments |
---|
| 4 | ; We give a min and a max, and the procedure send back |
---|
[142] | 5 | ; the good contour interval and labels's value. |
---|
[2] | 6 | ; |
---|
[231] | 7 | ; @categories |
---|
[157] | 8 | ; Graphics |
---|
[2] | 9 | ; |
---|
[237] | 10 | ; @param MIN {in}{required} {type=float} |
---|
| 11 | ; above what value we want to trace a contour |
---|
[2] | 12 | ; |
---|
[237] | 13 | ; @param MAX {in}{required} {type=float} |
---|
| 14 | ; below what value we want to trace a contour |
---|
[2] | 15 | ; |
---|
[237] | 16 | ; @param CI {out} {type=real} |
---|
| 17 | ; the contour interval. Use it in <proidl>CONTOUR</proidl> with the |
---|
| 18 | ; keyword LEVEL. |
---|
[2] | 19 | ; |
---|
[142] | 20 | ; @restrictions |
---|
| 21 | ; CI is a multiple of the unity in unity log of 10. |
---|
[237] | 22 | ; It force the number of contours to be even. |
---|
[2] | 23 | ; |
---|
[142] | 24 | ; @history |
---|
[157] | 25 | ; G. Roullet / aout 99 (gr\@lodyc.jussieu.fr) |
---|
[2] | 26 | ; |
---|
[142] | 27 | ; @version |
---|
| 28 | ; $Id$ |
---|
[2] | 29 | ; |
---|
| 30 | ;- |
---|
| 31 | PRO autoscale, min, max, ci |
---|
| 32 | ; |
---|
[114] | 33 | compile_opt idl2, strictarrsubs |
---|
| 34 | ; |
---|
[237] | 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. |
---|
[2] | 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 | ; |
---|
[142] | 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. |
---|
[2] | 47 | ; |
---|
[231] | 48 | WHILE ceil((max-min)/ci) GE 30 DO BEGIN |
---|
[2] | 49 | ci = ci0*coef[n] |
---|
| 50 | n = n+1 |
---|
[231] | 51 | ENDWHILE |
---|
[2] | 52 | |
---|
| 53 | min = floor(min/ci/2)*ci*2 |
---|
| 54 | max = ceil(max/ci/2)*ci*2 |
---|
| 55 | |
---|
[231] | 56 | nlevels = round((max-min)/ci) |
---|
| 57 | |
---|
[2] | 58 | ; |
---|
[142] | 59 | ; We force the number of contour to be even |
---|
[2] | 60 | ; |
---|
[231] | 61 | IF nlevels MOD 2 EQ 1 THEN BEGIN |
---|
[2] | 62 | nlevels = nlevels+1 |
---|
| 63 | max = max+ci |
---|
[231] | 64 | END |
---|
| 65 | END |
---|