load "$NCARG_ROOT/lib/ncarg/nclex/gsun/gsn_code.ncl" begin ; ; Generate some dummy data. ; PI = 3.14159 PI2 = 2 * PI npts = 99 x = ispan(10,500,5) y = new((/3,npts/),float) y(0,:) = sin(x*PI2/npts) y(1,:) = 3. + y(0,:) y(2,:) = 6. + y(0,:) ; ; Open an X11 window and change the foreground/background colors ; wks = gsn_open_wks("ncgm","dashlines") ; Open an X11 workstation. setvalues wks "wkBackgroundColor" : (/1.,1.,1./) "wkForegroundColor" : (/0.,0.,0./) end setvalues ; ; Create three new dash patterns. ; dpats = (/"$_____$_____$$_____$$_____$$_____$$_____$$___", \ "$$$$$$$$$$$$$$$$$$$$$$$______________________", \ "$$$$$______________$$$$$$$_____" /) ; ; Add these dash patterns to the current dash pattern table. ; new_indexes = NhlNewDashPattern(wks,dpats) xyres = True xyres@gsnMaximize = True ; Maximize plot in frame. xyres@xyLineColors = (/2,3,4/) ; Define line colors. xyres@xyLineThicknesses = (/3,3,3/) ; Define line thicknesses. xyres@xyDashPatterns = new_indexes ; Define line patterns. xyres@tiMainString = ":F21:Line plot with user-defined dashlines" plot = gsn_xy(wks,x,y,xyres) end