;************************************************* ; NCL Graphics: leg_3.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") ;************************************************ ; read in zonal winds ;************************************************ lat=a->lat nlat=dimsizes(lat) u = a->U(0,:,:) uz = dim_avg(u) v = a->V(0,:,:) vz= dim_avg(v) uz!0="lat" uz&lat=lat vz!0="lat" vz&lat=lat data=new( (/2,nlat/),float) data(0,:)=uz data(1,:)=vz ;************************************************ ; create plot ;************************************************ wks = gsn_open_wks("ps","leg") res = True res@pmLegendDisplayMode = "Always" ; turn on legend res@pmLegendSide = "Top" ; Change location of res@pmLegendParallelPosF = .45 ; move units right res@pmLegendOrthogonalPosF = -0.4 ; move units down res@pmLegendWidthF = 0.15 ; Change width and res@pmLegendHeightF = 0.18 ; height of legend. res@lgLabelFontHeightF = .03 ; change font height res@lgOrientation = "horizontal" res@lgPerimOn = False ; turn off box res@xyMarkLineModes = (/"MarkLines","Lines"/) ; line style res@xyMarkers = (/14,0/) ; marker style res@xyMarkerColor ="red" ; marker color res@xyExplicitLegendLabels = (/"U","V"/) plot=gsn_csm_xy(wks,lat,data,res) end