;************************************************* ; NCL Graphics: bar_2.ncl ;************************************************ load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl" load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl" ;************************************************ begin f = addfile ("soi.nc", "r") ; add file date = f->date ; YYYYMM dsoik = f->DSOI_KET ; Darwin SOI Index via KET 11pt Smth dsoid = f->DSOI_DEC ; Darwin Decadal SOI Index dimDate = dimsizes(date) ; number of dates ; convert integer YYYYMM to float dateF = new (dimDate, float) do nd=0,dimsizes(date)-1 yyyy = date(nd)/100 mon = date(nd)-yyyy*100 dateF(nd) = yyyy + (mon-1)/12. end do ;********************************* ; create plot ;K******************************** wks = gsn_open_wks ("ps", "bar" ) res = True res@gsnScale = True ; these four resources allow the user to stretch the plot size, and ; decide exactly where on the page to draw it. res@vpXF = 0.10 ; In page coordinates, where to start res@vpYF = 0.75 ; the plot res@vpHeightF = 0.43 ; Changes the aspect ratio res@vpWidthF = 0.85 res@trYMinF = -3.0 ; min value on y-axis res@trYMaxF = 3.0 ; max value on y-axis res@tiYAxisString = "Anomalies" ; y-axis label res@tiMainString = "Darwin Southern Oscillation Index" ; title res@gsnYRefLine = 0. ; reference line res@gsnXYBarChart = True ; create bar chart res@gsnAboveYRefLineColor = "red" ; above ref line fill red res@gsnBelowYRefLineColor = "blue" ; below ref line fill blue plot = gsn_csm_xy (wks,dateF(::8),dsoik(::8),res) end