; *********************************************** ; xy_10.ncl ; ; Concepts illustrated: ; - Filling the area between two curves in an XY plot ; - Drawing Greek characters on an XY plot ; - Controlling the draw order of a polygon ; ; *********************************************** ; ; These files are loaded by default in NCL V6.2.0 and newer ; load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl" ; load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl" ;************************************************ begin ;************************************************ ; read in data ;************************************************ in = addfile("80.nc","r") TS = in->TS(0,:,:) nlat = dimsizes(TS&lat) ;************************************************ ; define a polygon centered with width of 2 sigma ;************************************************ xp = new( (/2*nlat/), float ) yp = new( (/2*nlat/), float ) do k=0,nlat-1 dx = sqrt(TS(k,{60})) yp(k) = TS(k,{60}) + dx xp(k) = TS&lat(k) xp(2*nlat-1-k) = TS&lat(k) yp(2*nlat-1-k) = TS(k,{60}) - dx end do ;************************************************ ; plotting parameters ;************************************************ wks = gsn_open_wks ("png","xy") ; send graphics to PNG file res = True ; plot mods desired res@gsnDraw = False ; don't draw res@gsnFrame = False ; don't advance frame res@xyLineThicknessF = 2. ; line thickness ; ; Note that a colon is the default function code. We recommend ; setting default code to be a tilde (~) in your .hluresfile. ; See: http://www.ncl.ucar.edu/Document/Graphics/hlures.shtml ; res@tiMainString = "A Title with ~F33~helas ~F21~Characters~" plot = gsn_csm_xy (wks,TS&lat,TS(:,{60}),res) ; create plot gsres = True ; poly res gsres@tfPolyDrawOrder = "Predraw" ; draw this first gsres@gsFillColor = "SlateBlue" ; color chosen dummy = gsn_add_polygon (wks,plot,xp,yp,gsres) ;************************************************* ; Add greek symbol to plot with gsn_text ;************************************************* txres = True ; text mods desired txres@txFontHeightF = 0.07 ; text font height gsn_text(wks,plot,"~F33~s",-50,240,txres) draw(plot) ; draw frame(wks) ; advance frame end