Hi Jimmy,
Thanks for your help! Attached please find my NCL scripts for the scatter plot.
The resources part for xy1 (resPL1) and xy2(resPL2) still don't work. Please let
me know if you find any mistake in the code at your convenient time:)
Thanks a lot,
-Lin
--- Lin Su http://atoc.colorado.edu/~sul/ ---- Original message ---- >Date: Sat, 26 Jul 2008 23:43:46 -0700 >From: "James Correia" <jimmyc42_at_gmail.com> >Subject: Re: regression plot >To: "Lin Su" <Lin.Su_at_colorado.edu> > > Hi you might try adding the resources: > res_at_gsnDraw = False > res_at_gsnFrame = False > issue your plot,xy1,xy2 commands > draw(plot) > frame(wks) > > jimmyc > > On Fri, Jul 25, 2008 at 8:58 PM, Lin Su > <Lin.Su_at_colorado.edu> wrote: > > Dear NCL users, > My scatter regression plot looks good. However, > when I am trying to define > different resources for the one-to-one line and > the fit line, they just don't work > at all. I plan to identify the two solid lines > (one-to-one line and the fit line) with > different colors and different lines (solid > and dash). Here is my definition for them: > ...... > resPL1 = True > resPL1_at_xyMarkLineModes = "Lines" > resPL1_at_xyDashPatterns = 18 > ; dash line > resPL1_at_xyLineThicknesses = 3 > resPL1_at_xyLineColors ="red" > > resPL2 = True > resPL2_at_xyMarkLineModes = "Lines" > resPL2_at_xyDashPatterns = 0 > ; solid line > resPL2_at_xyLineThicknesses = 3 > resPL2_at_xyLineColors ="black" > > plot = gsn_csm_xy(wks, AOD1, AOD2, res1) > xy1=gsn_add_polyline(wks,plot,DUSTAOD1,fit1,resPL1) > xy2=gsn_add_polyline(wks,plot,x,y,resPL2) > ...... > Any apparent error somewhere? > Also, attached please find the plot. > > Thanks a lot, > -Lin > --- > Lin Su > http://atoc.colorado.edu/~sul/ > > _______________________________________________ > ncl-talk mailing list > ncl-talk_at_ucar.edu > http://mailman.ucar.edu/mailman/listinfo/ncl-talk > > -- > James Correia Jr. > Post Doc > Climate Physics Group, PNNL
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl"
begin
path = "/Volumes/Data/Models/cam/AOD/aeronet/regression/"
fileHandle1= path + "reg6_total_aeronet.txt"
fileHandle2= path + "reg6_total_wbl.txt"
; Read data
DUSTAOD1 = asciiread(fileHandle1, (/126/), "float")
DUSTAOD2 = asciiread(fileHandle2, (/126/), "float")
rc1=regline(DUSTAOD1,DUSTAOD2)
fit1=new((/126/), typeof(DUSTAOD2))
fit1 = rc1*DUSTAOD1 + rc1_at_yintercept
ccr1=esccr(DUSTAOD1,DUSTAOD2,0)
;Note1 by Lin: the regression coefficient (rc1)is calculated by regline or regCoef (>2dim)
;Note2 by Lin: the correction coefficient is calculated by excel (CORREL)or NCL (esccr).
print(rc1)
print(ccr1)
AOD1 = new((/6,21/),float)
AOD2 = new((/6,21/),float)
AOD1(0,:)=DUSTAOD1(0:20)
AOD1(1,:)=DUSTAOD1(21:41)
AOD1(2,:)=DUSTAOD1(42:62)
AOD1(3,:)=DUSTAOD1(63:83)
AOD1(4,:)=DUSTAOD1(84:104)
AOD1(5,:)=DUSTAOD1(105:125)
AOD2(0,:)=DUSTAOD2(0:20)
AOD2(1,:)=DUSTAOD2(21:41)
AOD2(2,:)=DUSTAOD2(42:62)
AOD2(3,:)=DUSTAOD2(63:83)
AOD2(4,:)=DUSTAOD2(84:104)
AOD2(5,:)=DUSTAOD2(105:125)
; plotting
x=ispan(0,2,1)
y=ispan(0,2,1)
print("plotting")
wks = gsn_open_wks("x11", "reg6")
plot = new(1,graphic)
res1 = True
res1_at_gsnDraw = False ;don't draw
res1_at_gsnFrame = False
res1_at_xyMarkLineModes = (/"Markers","Markers","Markers","Markers","Markers","Markers"/) ; choose which have markers
res1_at_xyMarkers = (/3,5,7, 10, 12,16/) ; choose type of marker
res1_at_xyMarkerColors = (/"red","blue","orange","green","cyan","purple"/) ; Marker color
res1_at_xyMarkerSizeF = (/0.01,0.01,0.01,0.01,0.01,0.01/) ; Marker size (default 0.01)
res1_at_xyDashPatterns = 1 ; solid line
res1_at_xyLineThicknesses = 3 ; set second line to 2
res1_at_pmLegendDisplayMode = "Always" ; turn on legend
res1_at_pmLegendSide = "Top" ; Change location of
res1_at_pmLegendParallelPosF = .3 ; move units right
res1_at_pmLegendOrthogonalPosF = -0.35 ; move units down
res1_at_pmLegendWidthF = 0.15 ; Change width and
res1_at_pmLegendHeightF = 0.18 ; height of legend.
res1_at_lgPerimOn = True ; turn off box around
res1_at_lgTitleFontHeightF = .05
res1_at_lgLabelFontHeightF = .015 ; label font height
res1_at_xyExplicitLegendLabels = (/"Beijing","Anmyon","Shirahama","Midway","Lanai","Mauna Loa"/)
res1_at_tiXAxisString = "AOD[500nm],AERONET"
res1_at_tiXAxisFontHeightF = 0.02
res1_at_tiYAxisString = "AOD[500nm],Model"
res1_at_tiYAxisFontHeightF = 0.02
res1_at_trXLog = False
res1_at_trYLog = False
res1_at_trXMinF = 0.0
res1_at_trXMaxF = 2.0
res1_at_trYMinF = 0.0
res1_at_trYMaxF = 2.0
resPL1 = True
resPL1_at_xyMarkLineModes = "Lines"
resPL1_at_xyDashPatterns = 18 ; dash line
resPL1_at_xyLineThicknesses = 3
resPL1_at_xyLineColors ="red"
resPL2 = True
resPL2_at_xyMarkLineModes = "Lines"
resPL2_at_xyDashPatterns = 0 ; solid line
resPL2_at_xyLineThicknesses = 3
resPL2_at_xyLineColors ="black"
plot = gsn_csm_xy(wks, AOD1, AOD2, res1)
xy1=gsn_add_polyline(wks,plot,DUSTAOD1,fit1,resPL1)
xy2=gsn_add_polyline(wks,plot,x,y,resPL2)
resP = True
resP_at_gsnFrame =False
resP_at_txFontHeightF = .01
resP_at_gsnPanelBottom = 0.0
resP_at_gsnPanelYWhiteSpacePercent = 5.
resP_at_gsnPanelFigureStrings = (/"y=0.902x+0.061 R=0.724"/)
resP_at_gsnPanelFigureStringsFontHeightF = 0.02
resP_at_gsnMaximize = True ;fill the page
gsn_panel (wks, plot, (/1,1/), resP)
;draw(plot)
frame(wks)
end
_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Sun Jul 27 2008 - 21:11:57 MDT
This archive was generated by hypermail 2.2.0 : Mon Jul 28 2008 - 09:07:16 MDT