;***************************************************** ; This example illustrates the creation of three ; overlapping curves with different filled colors ; surrounding 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 3 dummy curves. x = ispan(0,NPTS-1,1) theta = PI100*x ymean1 = sin(theta) ymean2 = 5+sin(2*sqrt(fabs(theta))) ymean3 = 100+sin(3*sqrt(fabs(theta))) ; axes ranges. ;---Create dummy upper bounds of the three curves yupper1 = ymean1 + 0.25 yupper2 = ymean2 + 0.25 yupper3 = ymean3 + 0.25 ;---Create dummy lower bounds of the three curves ylower1 = ymean1 - 0.25 ylower2 = ymean2 - 0.25 ylower3 = ymean3 - 0.25 ;---Collect all 9 variables into 3 arrays y1 = new((/3,NPTS/),float) ; (/ymean1, yupper1, ylower1/) y2 = new((/3,NPTS/),float) ; (/ymean2, yupper2, ylower2/) y3 = new((/3,NPTS/),float) ; etc y1(0,:) = ymean1 y2(0,:) = ymean2 y3(0,:) = ymean3 y1(1,:) = yupper1 y2(1,:) = yupper2 y3(1,:) = yupper3 y1(2,:) = ylower1 y2(2,:) = ylower2 y3(2,:) = ylower3 ;---Start the graphics wks = gsn_open_wks("png","fill_gsn_csm_xy3") ;---Define a common set of resources for all three plots res = True res@xyMonoDashPattern = True ; Solid lines for all curves res@xyLineThicknesses = (/3.0,1.0,1.0/) ;---Set up resource lists for individual plots res1 = res res2 = res res3 = res curve_colors = (/"red", "blue", "orange"/) fill_colors = (/"lavender","yellow","forestgreen"/) ;---Y curve associated with left axis res1@tiMainString = "gsn_csm_xy3(wks,x,y1,y2,y3,r1,r2,r3)" res1@tiMainFontHeightF = 0.02 res1@gsnLeftString = "Y1" res1@gsnCenterString = "Y2" res1@gsnLeftStringFontColor = curve_colors(0) res1@gsnCenterStringFontColor = curve_colors(1) res1@gsnRightStringFontColor = curve_colors(2) res1@gsnLeftString = "Y1" res1@gsnCenterString = "Y2" res1@gsnRightString = "Y3" res1@gsnStringFontHeightF = 0.02 res1@gsnXYFillColors = fill_colors(0) ; res1@xyLineColors = (/curve_colors(0),"transparent","transparent"/) res1@xyLineColors = (/curve_colors(0),"black","black"/) res1@trYMinF = min(y1) res1@trYMaxF = max(y1) res1@tmYLLabelFontColor = curve_colors(0) ;---Y curve associated with middle axis ; res2@xyLineColors = (/curve_colors(1),"transparent","transparent"/) res2@xyLineColors = (/curve_colors(1),"black","black"/) res2@trYMinF = min(y2) res2@trYMaxF = max(y2) res2@tmYRLabelFontColor = curve_colors(1) res2@gsnXYFillColors = fill_colors(1) ;---Y curve associated with right axis ; res3@xyLineColors = (/curve_colors(2),"transparent","transparent"/) res3@xyLineColors = (/curve_colors(2),"black","black"/) res3@trYMinF = min(y3) res3@trYMaxF = max(y3) res3@tmYRLabelFontColor = curve_colors(2) res3@gsnXYFillColors = fill_colors(2) res1@vpXF = 0.1 ; Move a little to left xy = gsn_csm_xy3(wks,x,y1,y2,y3,res1,res2,res3) end