<div dir="ltr"><div>
<div><span></span><br></div><div>hi, </div><div> i ploted a figure with fitting function and R-squared coefficient in the legend showed below:</div><div><img src="cid:_Foxmail.1@2b5c6af4-2297-7377-9c2c-f51801d17bef" border="0"></div><div> in the legend , there are symbols <font color="#0000ff"><u><b>black solid line</b></u></font> and<font color="#0000ff"> <u><b>red point</b></u> </font>existing in the front of R-squared and the fitting function, </div><div>i want to get rid of the black solid line and red point in the legend,<span style="line-height:1.5;font-size:10.5pt;background-color:window">and only leave the behind expression.</span></div><div><span style="line-height:1.5;font-size:10.5pt;background-color:window">but i don't know which attribute can be assigned in my script as following:</span></div><div><span style="line-height:1.5;font-size:10.5pt;background-color:window">++++++++++++++++++++++++++++++<wbr>+++++++++++++++++++++++++++</span></div><div>load "$NCARG_ROOT/lib/ncarg/<wbr>nclscripts/csm/gsn_code.ncl"<br>load "$NCARG_ROOT/lib/ncarg/<wbr>nclscripts/csm/gsn_csm.ncl"<br>load "$NCARG_ROOT/lib/ncarg/<wbr>nclscripts/csm/contributed.<wbr>ncl"<br><br>begin<br>;*****************************<wbr>*******************<br>; Read data from file [time, <wbr>value]. <br>; Missing values (_FillValue) <wbr>indicated by -9999.0<br>;*****************************<wbr>*******************<br><br> txtfiles=systemfunc("ls *.<wbr>txt")<br> nfiles=dimsizes(txtfiles)<br><br> do i=0,nfiles-1<br><br> ncol = 3<br> ;nrow = systemfunc("wc -l <wbr>"+txtfiles(i))<br> nrow = numAsciiRow(<wbr>txtfiles(i))<br> data = asciiread(txtfiles(<wbr>i), (/nrow,ncol/), "float")<br> data@_FillValue = -999.0 <br><br> y = data(:,0) <wbr> ; O3 <br> x1 = data(:,1) <wbr> ; NO2<br> x2 = data(:,2) <wbr> ; CO<br> <br> xvaro3=variance(y)<br><br>;*****************************<wbr>*******************<br>; calculate the regression <wbr>coefficient (slope) <br>;*****************************<wbr>*******************<br> rc1 = regline(x1, y) <wbr> ; slope <br> rc1@units = "DU" <br> print(rc1)<br><br> x1resvaro3 = variance((y-(<wbr>rc1*x1+rc1@yintercept)))<br> cod1 = 1.0-(x1resvaro3/<wbr>xvaro3)<br><br> rc2 = regline(x2, y) <wbr> ; slope <br> rc2@units = "DU" <br> print(rc2)<br> <br> x2resvaro3 = variance((y-(<wbr>rc2*x2+rc2@yintercept)))<br> cod2 = 1.0-(x2resvaro3/<wbr>xvaro3)<br><br>;*****************************<wbr>*******************<br>; create an array to hold <wbr>both the original data<br>; and the calculated <wbr>regression line <br>; ---------<br>; y = mx+b <br>; m is the slope: <wbr>rc returned from regline<br>; b is the y intercept: <wbr>rc@yave attribute of rc <wbr>returned from regline<br>;*****************************<wbr>*******************<br><br>;;; O3->NO2 <br> pltarry1 = new ( (/2,<wbr>nrow/), typeof(data), data@_<wbr>FillValue)<br><br> pltarry1(0,:) = y <wbr> ; use <wbr>markers<br> pltarry1(1,:) = rc1*(x1-<wbr>rc1@xave) + rc1@yave <wbr>; use solid line<br><br>;;;; O3->CO<br> pltarry2 = new ( (/2,<wbr>nrow/), typeof(data), data@_<wbr>FillValue)<br><br> pltarry2(0,:) = y <wbr> ; use <wbr>markers<br> pltarry2(1,:) = rc2*(x2-<wbr>rc2@xave) + rc2@yave ; <wbr>use solid line<br> <br><br>;*****************************<wbr>*******************<br>; plotting parameters<br>; This illustrates one <wbr>approach. Overlays could also <wbr>be used.<br>;*****************************<wbr>*******************<br> rmfiles=systemfunc("rm "+"<wbr>2010_678.png")<br> wks = gsn_open_wks("png","<wbr>2010_678") <br> <br> res = <wbr>True ; plot <wbr>mods desired<br> res@gsnDraw =<wbr> False<br> res@gsnFrame =<wbr> False<br> res@xyMarkLineModes = (<wbr>/"Markers","Lines"/) ; <wbr>choose which have markers<br> res@xyMarkers = <wbr>16 ; <wbr>choose type of marker <br> res@xyMarkerColor = "<wbr>red" ; <wbr>Marker color<br> res@xyMarkerSizeF = <wbr>0.01 ; <wbr>Marker size (default 0.01)<br> res@xyDashPatterns = <wbr>1 ; <wbr>solid line <br> res@xyLineThicknesses = (<wbr>/1,2/) ; set <wbr>second line to 2<br> res@tmYLFormat = "<wbr>f" ; not <wbr>necessary but nicer labels <br> ;res@lgPerimOn = <wbr> False<br><br> res@pmLegendDisplayMode <wbr>= "Always" ; turn <wbr>on legend<br><br> ;res@tiMainString <wbr>= "Output from regline" ; <wbr>title<br> res1 = True<br> res1 = res<br> <br> ;res1@lgLineLabelsOn = <wbr>False<br> res1@pmLegendSide <wbr> = "Bottom" ; <wbr>Change location of <br> res1@pmLegendParallelPosF <wbr> = .63 ; move <wbr>units right<br> res1@pmLegendOrthogonalPosF<wbr> = -0.5 ; move <wbr>units down<br> <br> res1@pmLegendWidthF <wbr> = 0.15 ; <wbr>Change width and<br> res1@pmLegendHeightF <wbr> = 0.18 ; <wbr>height of legend.<br> res1@lgLabelFontHeightF <wbr> = .02 ; <wbr>change font height<br><br> res1@tiYAxisString = <wbr>"O3(DU)"<br> res1@tiXAxisString = <wbr>"NO2(DU)"<br> <br><br> ;; it function and R-<wbr>squared<br> x1ff ="y="+tostring(rc1)+"*<wbr>x"+"+"+tostring(rc1@yintercept<wbr>)<br> x1fr2="R~S~2~N~="+tostring(<wbr>cod1)<br><br> print(x1ff)<br> print(x1fr2)<br><br> res1@xyExplicitLabels =(/<wbr>x1ff,x1fr2/)<br> <br> plot1 = gsn_csm_xy (wks,<wbr>x1,pltarry1,res1) ; <wbr>create plot<br><br> res2 = True<br> res2 = res<br> <br> ;res2@lgLineLabelsOn = <wbr>False<br> res2@pmLegendSide <wbr> = "Bottom" ; <wbr>Change location of <br> res2@pmLegendParallelPosF <wbr> = .65 ; move <wbr>units right<br> res2@pmLegendOrthogonalPosF<wbr> = -0.5 ; move <wbr>units down<br> <br> res2@pmLegendWidthF <wbr> = 0.15 ; <wbr>Change width and<br> res2@pmLegendHeightF <wbr> = 0.18 ; <wbr>height of legend.<br> res2@lgLabelFontHeightF <wbr> = .02 ; <wbr>change font height<br><br> res2@tiYAxisString = <wbr>"O3(DU)"<br> res2@tiXAxisString = <wbr>"CO(DU)"<br><br><br> ;; fit function and R-<wbr>squared<br> x2ff = "y="+tostring(rc2)+"<wbr>*x"+"+"+tostring(rc2@<wbr>yintercept)<br> x2fr2 = "R~S~2~N~="+<wbr>tostring(cod2)<br><br> res2@xyExplicitLabels =(/<wbr>x2ff,x2fr2/)<br><br> plot2 = gsn_csm_xy (wks,<wbr>x2,pltarry2,res2) ; <wbr>create plot<br> <br> ;---Draw both plot in a <wbr>panel.<br> pres = <wbr>True<br> pres@gsnMaximize = <wbr>True<br> ;pres@gsnPanelLabelBar = <wbr>True<br> pres@txString = "<wbr>2010 summer" <br> ;pres@pmLabelBarWidthF = 0.<wbr>6<br> pres@lbLabelFontHeightF = <wbr>0.01 ; make <wbr>labels smaller<br><br> gsn_panel(wks,(/plot1,<wbr>plot2/),(/1,2/),pres)<br><br> delete([/pltarry1,pltarry2/<wbr>])<br> delete([/res,res1,res2/])<br> delete([/rc1,rc2/])<br> delete(data)<br> delete([/x1resvaro3,<wbr>x2resvaro3,cod1,cod2/])<br> delete([/x1ff,x1fr2,x2ff,<wbr>x2fr2/])<br> <br> <br><br> end do<br><br><br>end<br></div><div><span style="line-height:1.5;font-size:10.5pt;background-color:window"><br></span></div><div><span style="line-height:1.5;font-size:10.5pt;background-color:window">++++++++++++++++++++++++++++++<wbr>+++++++++++++++++++++++++++</span></div><div><span style="line-height:1.5;font-size:10.5pt;background-color:window"> </span></div><div> any help would be appreciated!</div><div><br></div><div><br></div>
<div><br></div><hr size="1" align="left" color="#b5c4df" style="width:210px;min-height:1px">
<div><span><div style="margin:10px;font-family:verdana;font-size:10pt"><div><a href="mailto:dyjbean@gmail.com" target="_blank">dyjbean@gmail.com</a></div></div></span></div>
</div></div>