; *********************************************** ; xy_1.ncl ; *********************************************** load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl" load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl" ;************************************************ begin ;************************************************ ; read in data ;************************************************ f = addfile ("./uv300.nc","r") u = f->U ; get u data ;************************************************ ; to plot multiple lines, you must put them into ; a mulidimensional array ;************************************************ data = new((/2,dimsizes(u&lat)/),float) data(0,:) = u(0,:,{82}) data(1,:) = u(0,:,{-69}) ;************************************************ ; plotting parameters ;************************************************ wks = gsn_open_wks ("ps","xy") ; open workstation res = True ; plot mods desired res@tiMainString = "Mulitple XY plot" ; add title ; note a similiar resource is xyLineThicknessF, which will effect all ; the lines in the array. res@xyLineThicknesses = (/1.0,2.0/) ; make 2nd lines thicker res@xyLineColors = (/"blue","red"/) ; change line color plot = gsn_csm_xy (wks,u&lat,data,res) ; create plot ; ; Second plot, 3 curves. ; data2 = new((/3,dimsizes(u&lat)/),float) data2(0,:) = u(0,:,{82}) data2(1,:) = u(0,:,{0}) data2(2,:) = u(0,:,{-69}) delete(res@xyLineColors) ; Don't need these two resources delete(res@xyLineThicknesses) ; anymore. res@xyDashPattern = 0 ; Make curves all solid res@xyMarkLineMode = "MarkLines" ; Markers *and* lines res@xyMarkers = (/6,11,16/) ; 3 different markers res@xyMarkerColors = (/"blue","red","green"/) ; 3 different colors res@tiMainString = "Mulitple XY plot with markers" ; add title plot = gsn_csm_xy (wks,u&lat,data2,res) ; create plot end