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_ex05") res = True ; Plot mods desired res@gsnFrame = False ; Don't advance frame. 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" drawNDCGrid(wks) ; Draw an NDC grid to help w/placement of primitives. 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. lnres = True lnres@gsLineThicknessF = 3.0 ; 1.0 is the default ;---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/) lnres@gsLineColor = colors(i) gsn_polyline_ndc(wks,xbox,ybox,lnres) gsn_text_ndc(wks,sh_labels(i),xp+width+0.005,yp-height/2.,txres) end do frame(wks) end