begin arr = (/-2.22,-0.54,-1.4, -3.,-1.2,0.1/) ; Data for bars. minval = (/-2.6, -0.68, -2., -4.,-1.4/) maxval = (/-1.87,-0.4, -1.,-1.9,-1.0/) wks = gsn_open_wks("png","bar1j") ; Open "bar1j.png" png file. gsn_merge_colormaps(wks,"BlWhRe","default") ; Merge two color maps. res = True ; Plot options desired. res@gsnDraw = False ; Turn off draw/frame b/c we want res@gsnFrame = False ; to attach stuff to plot first. res@vpXF = 0.15 ; Move slightly to left res@vpWidthF = 0.8 ; Change aspect ratio of plot. res@vpHeightF = 0.44 res@trXMinF = 0 ; Set X and Y axes limits. res@trXMaxF = 7 res@trYMinF = -4.8 res@trYMaxF = 1 res@gsnXYBarChart = True res@gsnYRefLine = 0. ; Reference line, necessary ; for bar chart. res@gsnAboveYRefLineBarPatterns = (/-1,-1,-1,-1,-1,-1/) ; No fill res@gsnBelowYRefLineBarPatterns = (/-1,-1,-1,-1,-1,-1/) res@gsnXYBarChartBarWidth = 0.5 ; Change bar widths res@tiYAxisString = "Radiative Forcing " + \ "(Watts per square meter)" res@tiYAxisFontHeightF = 0.015 res@tiYAxisOffsetXF = -.017 ; Move Y label toward plot. res@tmXBOn = False ; Turn off top, bottom, res@tmXTOn = False ; and right tickmarks. res@tmYROn = False res@tmYLLabelFontHeightF = 0.015 ; Font sizes res@tmYLLabelDeltaF = -0.5 ; Scoot towards plot. res@tmYLPrecision = 1 ; No zeros after decimal res@xyLineThicknessF = 3 ; 3x as thick. res@xyLineColors = (/"red","blue"/) ; Above/below colors plot = gsn_csm_xy(wks,ispan(1,6,1),arr,res) ; Create the plot, but ; don't draw it. l1dum = new(5,graphic) ; Dummy variables for adding polylines. l2dum = new(5,graphic) l3dum = new(5,graphic) gdum = new(2,graphic) ; Dummy variable for adding polygons. tdum = new(9,graphic) ; Dummy variable for adding text strings. ; ; Add the polygons, lines, and text in the order you want them ; drawn. Order can be important, as a filled polygon will hide ; anything if it is drawn over it. ; gres = True ; Polygon mods desired gres@gsFillColor = "LightBlue" ; Polygon fill color xpts = (/0.,0.,7.,7.,0./) ypts = (/0.,-5.,-5.,0.,0./) gdum(0) = gsn_add_polygon (wks,plot,xpts,ypts,gres) ; Add the polygon. gres@gsFillColor = "LightPink" xpts = (/0.,0.,7.,7.,0./) ypts = (/0.,2.,2.,0.,0./) gdum(1) = gsn_add_polygon (wks,plot,xpts,ypts,gres) ; Add the polygon. ; ; Add some lines to the plot. ; lres = True ; Polyline mods desired lres@gsLineColor = "black" ; Color of lines lres@gsLineThicknessF = 2.5 ; Thickness of lines time = fspan(1,5,5) colors = (/"darkgreen","darkgreen","darkgreen","darkgreen","darkgreen"/) do ii = 0,4 lres@gsLineColor = colors(ii) l1dum(ii) = gsn_add_polyline(wks,plot,(/time(ii),time(ii)/), \ (/minval(ii),maxval(ii)/),lres) l2dum(ii) = gsn_add_polyline(wks,plot,(/time(ii)-.08,time(ii)+.08/), \ (/maxval(ii),maxval(ii)/),lres) l3dum(ii) = gsn_add_polyline(wks,plot,(/time(ii)-.08,time(ii)+.08/), \ (/minval(ii),minval(ii)/),lres) end do ; ; Add a reference line at y = 0. ; lres@gsLineThicknessF = 3 ; 3x as thick lres@gsLineColor = "black" ; Color of line ldum = gsn_add_polyline(wks,plot,(/0.,7./),(/0.,0./),lres) ; ; Add some text strings inside the plot. ; tres = True tres@txFontHeightF = 0.015 ; Font height tdum(0) = gsn_add_text(wks,plot,"CO~B~2~N~",1,-3.,tres) tdum(1) = gsn_add_text(wks,plot,"CH~B~4~N~ + N~B~2~N~O",2,-.97,tres) tdum(2) = gsn_add_text(wks,plot,"Mineral Dust",3,-2.4,tres) tdum(3) = gsn_add_text(wks,plot,"Continental ice",4,-4.35,tres) tdum(4) = gsn_add_text(wks,plot,"+ sea level",4,-4.6,tres) tdum(5) = gsn_add_text(wks,plot,"Vegetation",5,-1.77,tres) tdum(6) = gsn_add_text(wks,plot,"Orbital",6,0.45,tres) ; ; This is a little bit of trickery here going on in order to attach ; a text string using data coordinates, but then forcing it to be ; outside the plot by adding a bunch of carriage returns (~C~) after it. ; tres@txFontHeightF = 0.012 tres@txAngleF = 90. ; Rotate text 90 deg. tres@txJust = "CenterRight" ; Text justification (based on ; rotated string) tdum(7) = gsn_add_text(wks,plot,"cooling~C~ ~C~ ~C~ ~C~",0,-2,tres) tdum(8) = gsn_add_text(wks,plot,"warming~C~ ~C~ ~C~ ~C~",0,.5,tres) draw(plot) ; Drawing the plot will now draw everything attached frame(wks) ; to it. Don't forget to advance the frame! end