begin ; dbz_data = random_uniform(-9,60,100) dbz_data = (/0,0,13,160,2339,4632,7374,11044,14245,17172,24537,38696,51255,43006\ ,33918,32011,36194,46269,43924,26732,12078,4392,746,62,0/) wks = gsn_open_wks("png","histo_mary") res = True res@gsnMaximize = True res@tiMainString = "Let NCL pick the bin intervals" plot = gsn_histogram(wks,dbz_data,res) print(plot) ; this prints everything attached to plot print(plot@BinLocs) ; the actual bin ranges used ;---Set the intervals ourselves int_radar = ispan(-9,60,3) res@gsnHistogramBinIntervals = int_radar res@tiMainString = "Explicitly set bin intervals yourself" res@tmXBLabelFontHeightF = 0.01 ; make labels smaller plot = gsn_histogram(wks,dbz_data,res) delete(res@gsnHistogramBinIntervals) print(plot) ; this prints everything attached to plot print(plot@BinLocs) ; the actual bin ranges used ; ; Convert float data to integer data so we are sure to have some ; values exactly equal to -9, -8, ..., 60. Note that not ; every discrete bin will have values exactly equal, because this ; is random! ; idbz_data = toint(dbz_data) res@gsnHistogramDiscreteBinValues = int_radar res@tiMainString = "Explicitly set discrete bin values" plot = gsn_histogram(wks,idbz_data,res) end