; begin intervals = (/0,1,2,3,4,5,6,7,8,9,10/) n_ints = dimsizes(intervals) num_o = (/5700,3200,2170,1567,1187,923,700,550,430,341,273/) num_m = num_o/2 num_m_3 = num_o/4 labels = (/"Cont. Exp Decay","Initial Conds.","Time-Varying"/) nbins = dimsizes(intervals) x = ispan(1,nbins,1) wks = gsn_open_wks ("png","bars") res = True res@gsnDraw = False res@gsnFrame = False res@gsnMaximize = True ; Maximize size of each plot res@gsnXYBarChart = True ; Draw bars instead of curves res@gsnXYBarChartBarWidth = 0.5 ; Half the width res@trXMinF = 0 ; Add a margin so bars are not up against res@trXMaxF = nbins+1 ; the right or left Y axis res@tmXBMode = "Explicit" res@tmXBValues = x ; Indicate where we want tickmark lines res@tmXBLabels = ""+intervals ; Indicate what label we want under each line res@tiMainString = "Sensitivity to Initial Conditions" res@tiYAxisString = "Number of Grid-Elements" res@tiXAxisString = "Exceedance Values (#/3 hr)" res@trYMinF = 0 res@trYMaxF = 6000 ;---First plot, solid bars res@gsnXYBarChartColors = "grey" + ispan(40,95,5) ; Use grey fill for solid bars solid_bars = gsn_csm_xy(wks,x,num_o,res) ;---Second plot, pattern bars, X values will be shifted by 0.25 so bars can be seen res@xyCurveDrawOrder = "predraw" ; Draw patterned bar outlines under filled bar outlines res@gsnXYBarChartPatterns = 1 ; Use a cross hatch pattern for second set of bars pattern_bars = gsn_csm_xy(wks,x+.25,num_m,res) ; third plot res@xyCurveDrawOrder = "predraw" ; Draw patterned bar outlines under filled bar outlines res@gsnXYBarChartPatterns = 16 ; Use a cross hatch pattern for second set of bars pattern_other = gsn_csm_xy(wks,x+.75,num_m_3,res) overlay(pattern_other,pattern_bars) ; Solid bars will be overlaid on pattern bars overlay(pattern_other,solid_bars) ; Solid bars will be overlaid on pattern bars draw(pattern_other) ; This draws both pattern and fill bars ;;; label bars getvalues pattern_other ; get plot size for use in creating labelbar "vpXF" : vpx "vpYF" : vpy "vpHeightF" : vph "vpWidthF" : vpw end getvalues lbw = 0.4 * vpw ; Make labelbar size a fraction of the plot. lbh = 0.5 * vph nboxes = dimsizes(labels) lbres = True ; labelbar only resources lbres@vpWidthF = 0.4 * vpw ; labelbar width lbres@vpHeightF = 0.5 * vph ; labelbar height lbres@lbBoxMajorExtentF = 0.75 ; puts space between color boxes lbres@lbFillColors = res@gsnXYBarChartColors ; labelbar colors lbres@lbMonoFillPattern = (/0,1,16/) lbres@lbLabelFontHeightF = 0.008 ; font height. default is small lbres@lbLabelJust = "CenterLeft" ; left justify labels gsn_labelbar_ndc(wks,nboxes,labels,vpx+vph-lbw,0.77,lbres) frame(wks) end