;*****************************************************
; This example illustrates the creation of three
; overlapping curves with a gray fill area that
; surrounds each one, on three different axes.
;*****************************************************
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
begin
;---Define the number of points in each curve.
NPTS = 500
PI100 = 0.031415926535898
;---Create array for the three XY plots.
x = ispan(0,NPTS-1,1)
y1 = new((/3,NPTS/),float)
y2 = new((/3,NPTS/),float)
y3 = new((/3,NPTS/),float)
theta = PI100*x
y1(0,:) = sin(theta) ; Define the three curves,
y2(0,:) = 5+sin(2*sqrt(fabs(theta))) ; giving them unique Y
y3(0,:) = 100+sin(3*sqrt(fabs(theta))) ; axes ranges.
y1(1,:) = 0.25+y1(0,:) ; Define the upper and lower
y1(2,:) = -0.25+y1(0,:) ; bounds of each curve that
y2(1,:) = 0.25+y2(0,:) ; will be filled in gray.
y2(2,:) = -0.25+y2(0,:)
y3(1,:) = 0.25+y3(0,:)
y3(2,:) = -0.25+y3(0,:)
;---Start the graphics
wks = gsn_open_wks("pdf","fill_gsn_csm_xy3")
;---Define a common set of resources for all three plots
res = True
res@gsnDraw = False ; don't draw yet
res@gsnFrame = False ; don't advance frame yet
res@xyMonoDashPattern = True ; Solid lines for all curves
res@xyLineThicknesses = (/3.0/)
;instead of drawing individual lines, first draw the mean value
res@xyDashPatterns = (/0./)
;---Set up resource lists for individual plots
res1 = res
res2 = res
res3 = res
res1@trYMinF = min(y1)
res1@trYMaxF = max(y1)
res2@trYMinF = min(y2)
res2@trYMaxF = max(y2)
res3@trYMinF = min(y3)
res3@trYMaxF = max(y3)
ccolors = (/"red","blue","orange"/)
res1@xyLineColors = ccolors(0)
res2@xyLineColors = ccolors(1)
res3@xyLineColors = ccolors(2)
res1@vpXF = 0.1 ; Move a little to left
top_xy = gsn_csm_xy3(wks,x,y1(0,:),y2(0,:),y3(0,:),res1,res2,res3)
delete(res1@xyLineColors)
res1@gsnXYFillColors = "lightskyblue1"
res1@xyLineColor = -1 ; We don't want the line, so make it transparent.
delete(res2@xyLineColors)
res2@gsnXYFillColors = "lightskyblue1"
res2@xyLineColor = -1 ; We don't want the line, so make it transparent.
delete(res3@xyLineColors)
res3@gsnXYFillColors = "lightskyblue1"
res3@xyLineColor = -1
mid_plot = gsn_csm_xy3 (wks,x ,y1(1:2,:),y2(1:2,:),y3(1:2,:),res1,res2,res3)
overlay(mid_plot,top_xy)
pres = True
maximize_output(wks,pres)
end