pro histy,tab1,xx,hist, $ mini=mini,maxi=maxi,bin=bin,abs=abs,cumul=cumul,overplot=overplot ;+ ; FUNCTION : This procedure displays the histogram of the array TAB1 ; and creates output arrays XX, HIST for future plots. ; ; INPUT : tab1 --> array (NO DEFAULT) ; ; KEYWORDS : mini = minimum value (DEFAULT=min(tab1)) ; : maxi = maximum value (DEFAULT=max(tab1)) ; : bin = bin size (DEFAULT=(maxi-mini)/10) ; /abs --> compute the histogram in number of ; elements instead of in percentage (default) ; /cumul --> compute the cumulative histogram ; /overplot --> overplot the histogram ; ; OUTPUTS : display ; : XX --> array of abscissa values (optional) ; : HIST --> array of histogram values (optional) ; ; USAGE : histo, array ; histo, array, x, hist ; histo, array, min=1, bin=0.1, /abs, /overplot ; histo, array, x, hist, min=1, bin=0.1, /abs ...etc. ; ; CONTACT : Didier JOURDAN didier@esrg.ucsb.edu ; HISTORY : Modified by Michal, 16 Feb 1996 ;- if (keyword_set(mini) eq 0) then mini=min(tab1) if (keyword_set(maxi) eq 0) then maxi=max(tab1) if (keyword_set(bin) eq 0) then bin=(maxi-mini)/10. ; compute histogram hist=HISTOGRAM(tab1,binsize=bin,min=mini,max=maxi) ifin=n_elements(hist) sum=fltarr(ifin) ytitl1="number histogram" ytitl2=" " xtitl='value (binsize = '+strtrim(bin,2)+')' ; keyword abs inactive : percentage histogram if (keyword_set(abs) eq 0) then begin hist=float(hist)/total(hist) ytitl1="percentage histogram" endif ; keyword abs active : cumulative histogram if (keyword_set(cumul) ne 0) then begin for i=0,ifin-1 do begin sum(i)=total(hist(0:i)) endfor hist=sum ytitl2="cumulative " endif ; set ytitle ytitl=string(ytitl2,ytitl1) ytitl=strcompress(ytitl) ; set abscissa values xx=findgen(ifin)*bin+mini+bin/2. if (keyword_set(overplot) eq 0) then begin ; plot plot,xx,hist,psym=10,xrange=[mini,maxi], $ ytitle=ytitl,xtitle=xtitl,back=255,col=0 endif else begin ; overplot oplot,xx,hist,psym=10,col=0,linestyle=2 endelse end