;---Read data and calculate PDF a = addfile("test_file.nc","r") data = a->data printMinMax(data,0) ;---Calculate two sets of PDFs: 10 bins and 25 bins dpdf_25 = pdfx(data, 0, False) dpdf_10 = pdfx(data, 10, False) printVarSummary( dpdf_10 ) printVarSummary( dpdf_25 ) ;---Start the graphics section wks = gsn_open_wks ("png","bintest1") res = True res@gsnMaximize = True ; maximize plot in frame res@vpWidthF = 0.8 ; make plot wider than it res@vpHeightF = 0.4 ; is high res@gsnXYBarChart = True ; Draw the bins as bars res@gsnYRefLine = 0. ; instead of an XY curve res@gsnXYBarChartColors = "tan" res@tmXBMode = "Explicit" ; Label the X axis with the res@tmXBValues = dpdf_25@bin_bounds ; bin values res@tmXBLabels = sprintf("%4.2f",dpdf_25@bin_bounds) res@tmXBLabelFontHeightF = 0.008 ;---Plot the 25 bin PDF res@tiMainString = "pdfx - 25 bins" plot_25 = gsn_csm_xy (wks, dpdf_25@bin_center, dpdf_25, res) ;---Plot the 10 bin PDF res@tiMainString = "pdfx - 10 bins" res@tmXBValues := dpdf_10@bin_bounds ; bin values res@tmXBLabels := sprintf("%4.2f",dpdf_10@bin_bounds) plot_10 = gsn_csm_xy (wks, dpdf_10@bin_center, dpdf_10, res)