;************************************************* ; NCL Graphics: text_11.ncl ;************************************************ load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl" load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl" ;************************************************ begin ;************************************************ ; read in netCDF file ;************************************************ a = addfile("uv300.nc","r") u = a->U(0,:,8) ;************************************************ ; create plot ;************************************************ wks = gsn_open_wks("ps","text") res = True ; plot mods desired res@gsnDraw = False ; Turn off draw and frame so res@gsnFrame = False ; we can attach some text. res@tiYAxisString = "Left Y axis string" plot = gsn_csm_xy(wks,u&lat,u,res) ; create xy plot ; Retrieve font height of left axis string. getvalues plot "tiXAxisFontHeightF" : font_height end getvalues ; ; Create a right axis text string to add to plot. ; txres = True txres@txAngleF = 90. ; Rotate string clockwise txres@txFontHeightF = font_height ; Use same font height as left axis txid = gsn_create_text(wks, "Right Y axis string", txres) ; ; Move text string to center/right edge of plot. ; amres = True amres@amParallelPosF = 0.6 ; 0.5 is the right edge of the plot, so ; 0.6 is a little further to the right. amres@amOrthogonalPosF = 0.0 ; This is the center of the plot. amres@amJust = "CenterCenter" annoid = gsn_add_annotation(plot, txid, amres) ; Attach string to plot ; ; Since we added string to outside of plot area, we need to ; resize the plot so that it fits in the given workstation. ; This function draws the plot and advances the frame. ; psres = True psres@gsnPaperOrientation = "Portrait" maximize_output(wks,psres) end