load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl" load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl" load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl" load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl" begin ;---Create some data. We cannot verify the accuracy of these numbers. x = ispan(1,8,1) y = (/154900,56600,40000,30200,29700,24400,21700,13900/) labels = (/"Lung","Colon/rectum","Breast","Prostate","Pancreas",\ "Non-Hodgkin's~C~ Lymphoma","Leukemias","Ovary"/) colors = (/"FireBrick","Red","Orange","Green", "Navy", "Blue", \ "SkyBlue","SlateBlue"/) ;--- Create the plot wks = gsn_open_wks("x11","poly3_ex07") res = True ; Plot mods desired res@gsnFrame = False ; Don't advance frame. ;---Reposition and resize plot so it uses more of the frame. res@vpYF = 0.9 ; Default is 0.8 res@vpXF = 0.17 ; Default is 0.2 res@vpHeightF = 0.70 ; Default is 0.6 res@vpWidthF = 0.70 ; Default is 0.6 res@gsnXYBarChart = True ; Turn on bar chart. res@gsnXYBarChartBarWidth = 0.75 ; Change bar widths res@gsnXYBarChartColors = colors res@tmXBOn = False ; Turn off tickmarks at bottom. res@trYMinF = 0 ; Bring bars down to zero. res@trYMaxF = 160000 res@trXMinF = 0 ; Add space on either end res@trXMaxF = 9 ; of the first and last bars. res@tiMainString = "Estimated Cancer Deaths for 2002" plot = gsn_csm_xy (wks,x,y,res) ; Draw plot, don't advance frame. ;---Set up info for box. width = 0.07 ; Box width height = 0.05 ; Box height ;---Set coordinates for top left corner of the eight boxes. xpos = (/0.15,0.35,0.55,0.75,0.15, 0.35, 0.55, 0.75/) ypos = (/0.15,0.15,0.15,0.15,0.075,0.075,0.075,0.075/) ;---Line resources. gnres = True ;---Text resources. txres = True txres@txFontHeightF = 0.015 txres@txJust = "CenterLeft" sh_labels = (/"Lung","Colon","Breast","Prostate","Pancreas",\ "Lymphoma","Leukemias","Ovary"/) nboxes = dimsizes(xpos) do i = 0,nboxes-1 xp = xpos(i) yp = ypos(i) xbox = (/xp,xp+width,xp+width,xp,xp/) ybox = (/yp,yp,yp-height,yp-height,yp/) gnres@gsFillColor = colors(i) gsn_polygon_ndc(wks,xbox,ybox,gnres) gsn_polyline_ndc(wks,xbox,ybox,False) gsn_text_ndc(wks,sh_labels(i),xp+width+0.005,yp-height/2.,txres) end do frame(wks) end