;+ ; ; @file_comments ; We give a min and a max, and the procedure send back ; the good contour interval and labels's value. ; ; @categories ; Graphics ; ; @param MIN {in}{required} {type=float} ; above what value we want to trace a contour ; ; @param MAX {in}{required} {type=float} ; below what value we want to trace a contour ; ; @param CI {out} {type=real} ; the contour interval. Use it in CONTOUR with the ; keyword LEVEL. ; ; @restrictions ; CI is a multiple of the unity in unity log of 10. ; It force the number of contours to be even. ; ; @history ; G. Roullet / aout 99 (gr\@lodyc.jussieu.fr) ; ; @version ; $Id$ ; ;- ; PRO autoscale, min, max, ci ; compile_opt idl2, strictarrsubs ; ; Estimation of a first CI, notice the presence of the floor (Inferior round) ; This CI is a multiple of the unity in unity log of 10. ci = (max-min)/20. ci = 10.^floor(alog10(ci)) n = 0 ci0 = ci ; coef = [2, 2.5, 5, 10] ; ; We test differents CI (contour intervals), i.e. 1, 2, 2.5, 5 and 10 ; until the number of contour is inferior to 30. ; WHILE ceil((max-min)/ci) GE 30 DO BEGIN ci = ci0*coef[n] n = n+1 ENDWHILE min = floor(min/ci/2)*ci*2 max = ceil(max/ci/2)*ci*2 nlevels = round((max-min)/ci) ; ; We force the number of contour to be even ; IF nlevels MOD 2 EQ 1 THEN BEGIN nlevels = nlevels+1 max = max+ci END END