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 ;---------------------------------------------------------------------- ; Data is hard-coded here. It was originally calculated by running ; a compute-intensive script. ;---------------------------------------------------------------------- floatnames = (/"A","B","C","D","E","F","G"/) ;---Make AB a 3 x 3 array AB = (/(/-0.477,0,-1.142/),(/-1.032,0.278,-999/),(/0.664,5.819,-999/)/) AB@_FillValue = -999 print(AB) ; 3 x 3 array ;---------------------------------------------------------------------- ; Open a PS file and define the color table ;---------------------------------------------------------------------- colors = (/"white","black","blue","green","red"/) markers = (/4,7,3/) wks = gsn_open_wks ("ps","scatter") gsn_define_colormap(wks,colors) ;---------------------------------------------------------------------- ; Set some plot resources ;---------------------------------------------------------------------- res = True res@gsnDraw = False ; Don't draw plot res@gsnFrame = False ; Don't advance frame ; ; Don't use gsnMaximize. Instead, we will control ; exactly where plot goes. ; res@vpXF = 0.2 res@vpYF = 0.85 res@vpWidthF = 0.5 res@vpHeightF = 0.5 ;---Some calculations to get min/max for Y axis. miny = min(AB) maxy = max(AB) ;minx = min(floatnames) ;maxx = max(floatnames) amaxy = maxy - abs(miny) amaxy = amaxy / 2. amaxy = amaxy + 25. aminy = maxy - abs(miny) aminy = aminy / 2. aminy = aminy - 25. ;---XY marker resources res@xyMarkLineMode = "Markers" res@xyMarkerSizeF = 0.03 res@xyMarkerThicknessF = 3. res@xyMonoMarkerColor = False ; Allow different colors for markers res@xyMarkerColors = colors(2:) res@xyMarkers = markers res@trXMinF = -0.5 res@trXMaxF = 2.5 res@trYMinF = floor(min(AB)) res@trYMaxF = ceil(max(AB)) ; you need here ;---Tickmark resources res@tmXBMode = "Manual" res@tmYLMode = "Manual" res@tmXBTickSpacingF = 1. res@tmYLTickSpacingF = 5. ;---Title resources res@tiMainString = "30 av Annual % Change P vs Delta T~C~" + \ " for the WetSouth" res@tiXAxisString = "Delta T" res@tiYAxisString = "% Change P" res@tiMainFontHeightF = 0.03 ;---------------------------------------------------------------------- ; Create the scatter plot, but don't draw it yet. ;---------------------------------------------------------------------- plot = gsn_csm_y (wks,AB,res) ;---------------------------------------------------------------------- ; Draw time stamp first, then the plot. ;---------------------------------------------------------------------- infoTimeStamp(wks,0.005,"") draw(plot) frame(wks) ; Now advance the frame. end