; Replacement for the histogram function. Creates bins, bins data, and plots result ; Frequently the HISTOGRAM() function whines about the data set being too large, ; or some such rubbish. This function does not have this problem. ; ; Input ; A - Data to be binned. Must be a 2D array ; lo - Lower bound on bins ; hi - Upper bound on bins ; n - Number of bins to use ; Output ; bins - array of lower edge of each bin ; Return ; Number of items in each bin. Also does a surface plot of A on window 0, ; and a histogram plot on window 1 function histo2,a,lo,hi,n,bins=bins lo=min(a,/nan,max=hi) print,get_routine_name() + ' ', lo,hi bins=linterp(0,lo,n,hi,findgen(n+1)) result=bins*0 for i=0,n_elements(bins)-2 do begin junk=where(logical_and(a ge bins[i],a lt bins[i+1]),num) result[i]=num end wset,0 surface,a wset,1 plot,bins,result return,result end