1; 2; AC, June 2007 3; 4; please run the last procedure "TEST_PLOT_INFO" to have informations 5; about all the routines testing PLOT ... 6; 7; How are managed NaN and Inf in PLOT ? 8; 9pro PLOT_INF_NAN, nan=nan, inf=inf, psym=psym, $ 10 position=position, verbose=verbose 11; 12; the keywrod "position" is used to put the Nan or Inf at 13; a given position in the array --> may affect plot if bug in MinMax 14; procedure to check the min/max boudaries of the plot scale. 15; 16problem=0. 17if KEYWORD_SET(nan) then problem=!values.f_nan 18if KEYWORD_SET(inf) then problem=!values.f_infinity 19if (problem EQ 0.) then begin 20 print, 'Must select /Nan or /Inf' 21 return 22endif 23; 24if N_ELEMENTS(position) EQ 0 then position=4 25; 26if KEYWORD_SET(verbose) then begin 27 print, 'Type of Problem: ', problem 28 print, 'Position: ', position 29endif 30; 31a=findgen(10) 32a=a^2 33a[position]=problem 34if KEYWORD_SET(verbose) then begin 35 print, 'Min, no check on /Nan', min(a) 36 print, 'Max, no check on /Nan', max(a) 37 print, 'Min, check on /Nan', min(a,/nan) 38 print, 'Max, check on /Nan', max(a,/nan) 39endif 40plot, a, title=STRUPCASE(STRING(problem))+' case', psym=psym 41; 42; 43if KEYWORD_SET(verbose) then begin 44 print, '!x.crange: ', !x.crange 45 print, '!y.crange: ', !y.crange 46endif 47; 48end 49; 50; ------------------------------------ 51; 52pro TEST_PLOT_TRICK, nan=nan, inf=inf 53; 54; Same as PLOT_INF_NAN but more direct ! 55; (with peculiar tests for Min/Max (NaN or Inf at beginning or end of arrays)) 56; 57problem=0. 58if KEYWORD_SET(nan) then problem=!values.f_nan 59if KEYWORD_SET(inf) then problem=!values.f_infinity 60if (problem EQ 0.) then begin 61 print, 'Must select /Nan or /Inf' 62 return 63endif 64; 65!p.multi=[0,2,3] 66window, xsize=600, ysize=900 67; 68a=findgen(10) 69x=a 70y=a^2 71y[1]=problem 72plot,y, psym=-2, title='No problem in X' 73plot, x,y, psym=-2, title='Possible problem in X' 74; 75x=a 76y=a^2 77x[0]=problem 78x[9]=problem 79plot, y, psym=-4, title='No problem' 80plot,x,y, psym=-4, title='X problem at (0 and last)' 81; 82x=a 83y=a^2 84y[0]=problem 85y[9]=problem 86plot, y, psym=-4, title='Problem for Y (0 and last)' 87plot,x,y, psym=-4, title='X and Y problems at (0 and last)' 88; 89!p.multi=0 90; 91end 92; 93; ----------------------------------------------------- 94; 95pro TEST_PLOT_INF_NAN, psym=psym, verbose=verbose 96; 97print, 'pro TEST_PLOT_INF_NAN, psym=psym, verbose=verbose' 98; 99WINDOW,0 100PLOT_INF_NAN, /nan, psym=psym, verbose=verbose 101WINDOW,2 102PLOT_INF_NAN, /nan, psym=psym, pos=0, verbose=verbose 103; 104WINDOW,1 105PLOT_INF_NAN, /inf, psym=psym, verbose=verbose 106WINDOW,3 107PLOT_INF_NAN, /inf, psym=psym, pos=0, verbose=verbose 108; 109end 110; 111