<DIV>
<DIV>Hi:</DIV>
<DIV> All,I am trying to draw a dot-line in a xy_plot that <FONT color=#000000>emphasize different parts of it with different colors according to its values.</FONT></DIV>
<DIV><FONT color=#000000>I have found the example </FONT><A href="https://mail.qq.com/Scripts/newcolor_4.ncl"><FONT color=#000000>newcolor_4.</FONT></A><FONT color=#000000>ncl which attach pots with different size and color on the map according to the data value</FONT>.</DIV>
<DIV><IMG src="cid:2EE842E4@B414B908.182B6658.jpg" filesize="159805" naturalW="792" naturalH="612"></DIV>
<DIV> </DIV>
<DIV> I have write a scirpt according to the example,but the dots have same color.</DIV>
<DIV><IMG style="WIDTH: 494px; HEIGHT: 296px" src="cid:76E0A045@B414B908.182B6658.jpg" scalingmode="zoom" diffpixels="15px" modifysize="73%" filesize="37332" naturalW="671" naturalH="403"></DIV>
<DIV>This is my script:</DIV>
<DIV>load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl" <BR>load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl" <BR>load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"<BR>load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl"</DIV>
<DIV>begin</DIV>
<DIV> ;---Read in file as array of strings so we can parse each line.<BR> ; filename= "/public/home/huanglei/bias_T_5km.txt"<BR> ; lines := asciiread(filename,-1,"float")<BR> ; nlines = dimsizes(lines)-1 ; First line is a header<BR> <BR> data=new((/2,7/),float)</DIV>
<DIV> ; data(1,:)=lines(:,1) ;;get the aqi_data<BR> data(1,:)=(/10,25,56,90,230,450,490/)<BR>;;;;;;;;;;;;;;;;;;;make X axis;;;;;;;;;;;;;;;;;;;;;; </DIV>
<DIV> ;d1=new(1272,float)<BR> ;d1(0)=1<BR> ;do s=1,1271<BR> ; d1(s)=d1(s-1)+1<BR> ;end do<BR> data(0,:) = (/1,2,3,4,5,6,7/)<BR>;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; <BR>; We generate plots, but what kind do we prefer?;;;;make a fake plot to attach the pots ,line is white;;;<BR> type = "pdf"<BR> wks = gsn_open_wks(type,"xypot_aqi")<BR> <BR> res1=True<BR> <A href="mailto:res1@gsnFrame">res1@gsnFrame</A> = False<BR> <A href="mailto:res1@gsnDraw">res1@gsnDraw</A> = False <BR> <A href="mailto:res1@xyLineThicknesses">res1@xyLineThicknesses</A> = 0.1 ; make 2nd lines thicker<BR> <A href="mailto:res1@xyLineColors">res1@xyLineColors</A> = "white" ; change line color<BR> <A href="mailto:res1@pmLegendDisplayMode">res1@pmLegendDisplayMode</A> = "always" ; turn on legend<BR> <A href="mailto:res1@pmLegendSide">res1@pmLegendSide</A> = "Top" ; Change location of <BR> <A href="mailto:res1@pmLegendParallelPosF">res1@pmLegendParallelPosF</A> = .89 ; move units right<BR> <A href="mailto:res1@pmLegendOrthogonalPosF">res1@pmLegendOrthogonalPosF</A> = -1.17 ; more neg = down<BR> <A href="mailto:res1@lgPerimOn">res1@lgPerimOn</A> = False ; No legend perimeter.<BR> <A href="mailto:res1@trXMinF">res1@trXMinF</A> =1<BR> <A href="mailto:res1@trXMaxF">res1@trXMaxF</A> =7<BR> <A href="mailto:res1@tmXBMode">res1@tmXBMode</A> ="Explicit" <BR> <A href="mailto:res1@tmXBValues">res1@tmXBValues</A> =(/1,2,3,4,5,6,7/)<BR> <A href="mailto:res1@tmXBLabels">res1@tmXBLabels</A> = (/"8/1"," 8/11"," 8/21"," 9/1","9/11", \<BR> " 9/21","9/20"/)<BR> <A href="mailto:res1@vpHeightF">res1@vpHeightF</A> = 0.35<BR> <A href="mailto:res1@vpWidthF">res1@vpWidthF</A> = 0.75<BR> ;res1@tiYAxisString = "mm" ; add an axis title <BR> <A href="mailto:res1@gsnLeftString">res1@gsnLeftString</A> ="AQI of Xian"<BR> <A href="mailto:res1@pmLegendWidthF">res1@pmLegendWidthF</A> = 0.10 ; Change width and<BR> <A href="mailto:res1@pmLegendHeightF">res1@pmLegendHeightF</A> = 0.10 ; height of legend.<BR> <A href="mailto:res1@lgLabelFontHeightF">res1@lgLabelFontHeightF</A> = 0.02 ; change font height<BR> plot= gsn_csm_xy(wks,d1,data(1,:),res1)</DIV>
<DIV>;;;;;;attach the different color pots according to the data value;;;</DIV>
<DIV>;---Generate some levels to group the data values by.<BR> levels = ispan(0,500,50)<BR> nlevels = dimsizes(levels)</DIV>
<DIV> ;;;;;;;;;;;---For each range, we want a different color.<BR> colors = (/"yellow","green","orange","red","violet","violet","violetred4","violetred4","violetred4","violetred4"/)<BR>;;;;Arrays for attaching markers;;;</DIV>
<DIV> dot_fill_trn = new(nlevels-1,graphic)<BR>; For each range, gather the data that falls in this range<BR>; and draw the set of markers at those x/y locations.<BR>;<BR> mkres = True<BR> do i=0,nlevels-2<BR> ; print(i)<BR> ii = ind(levels(i).le.data(1,:).and.data(1,:).lt.levels(i+1))<BR> <BR> <A href="mailto:mkres@gsMarkerIndex">mkres@gsMarkerIndex</A> = 16 ; Filled dots<BR> <A href="mailto:mkres@gsMarkerSizeF">mkres@gsMarkerSizeF</A> = 5<BR> <A href="mailto:mkres@gsMarkerColor">mkres@gsMarkerColor</A> = colors(i)<BR> print(colors(i))<BR>;---Make markers partly transparent (1.0 is fully opaque)<BR> <A href="mailto:mkres@gsMarkerOpacityF">mkres@gsMarkerOpacityF</A> = 0.9<BR> dot_fill_trn(i) = gsn_add_polymarker(wks,plot,data(0,:),data(1,:),mkres)</DIV>
<DIV> delete(ii)<BR> end do</DIV>
<DIV>;---Drawing the map plots will draw all the attached markers too.<BR> draw(plot)<BR> frame(wks)<BR>end<BR></DIV>
<DIV>Can you slove this problem?Any information will be appreciated.</DIV></DIV>