<div dir="ltr"><div class="gmail_default" style="font-size:small">Geeta,</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">Your "if" statement is wrong. The condition "if any(rf.le.4.1)" is always going to resolve as True, because you are checking if *any* one of the rf values is <= 4.1. The "else" part of the statement never gets executed.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">If you want to set a different font color for each value, then you will need a do loop, because unfortunately we don't have a "txFontColors" type of resource that allows you to set an array of colors.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">Here's what your loop would look like:</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small"><div class="gmail_default"><font face="monospace, monospace"> nrf = dimsizes(rf)</font></div><div class="gmail_default"><font face="monospace, monospace"> colors = where(rf.le.4.1,"Blue","Red")</font></div><div class="gmail_default"><font face="monospace, monospace"> text = new(nrf,graphic)</font></div><div class="gmail_default"><font face="monospace, monospace"> do n=0,nrf-1</font></div><div class="gmail_default"><font face="monospace, monospace"> txres@txFontColor = colors(n)</font></div><div class="gmail_default"><font face="monospace, monospace"> text(n) = gsn_add_text(wks,plot,sprintf("%9.4g",rf(n)),lon(n),lat(n),txres)</font></div><div class="gmail_default"><font face="monospace, monospace"> end do </font></div><div class="gmail_default"><font face="monospace, monospace"> draw(plot)</font></div><div class="gmail_default"><font face="monospace, monospace"> frame(wks)</font></div></div><div class="gmail_default" style="font-size:small"><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Oct 15, 2015 at 11:49 AM, Geeta Geeta <span dir="ltr"><<a href="mailto:geetag54@yahoo.com" target="_blank">geetag54@yahoo.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div style="color:#000;background-color:#fff;font-family:HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,Sans-Serif;font-size:16px"><div dir="ltr">Yes I meant "clumsy " as the values close to the dots. <br></div><div dir="ltr">Yes all your suggestions are working very well. <br></div><div dir="ltr">Thanks a lot for that. <br></div><div dir="ltr"><br></div><div dir="ltr">I have another question. I was wondering if I can give different colours to the values. I mean if rainfall in in range of 0.1-2.4, then I write the actual value by Yellow color<br></div><div dir="ltr">if 2.5 -10.0 say then I write the actual value by Green color</div><div dir="ltr"><br></div><div dir="ltr">Instead of all uniform colour like Blue I have chosen <br></div><div dir="ltr"><br></div><div dir="ltr">For this I tried with if statement before the Text Res like this. <br></div><div dir="ltr"><br> txres = True<br> txres@txFontHeightF = 0.012<br> txres@txFont = "helvetica-bold"<br>;<br> if any(rf.le.4.1) then<br> txres@txFontColor = "Blue"<br>; txres@txFontQuality = "High"<br>; txres@txJut = "TopRight "<br>else<br>if any(rf.gt.4.1) then<br>txres@txFontColor = "Red"<br>end if<br>end if<br> <br> text = gsn_add_text(wks,plot," "+sprintf("%9.4g",rf),lon,lat,txres)<br></div><div dir="ltr"><br></div><div dir="ltr">But It is plotted in Blue only. <br></div><div dir="ltr">my input file looks like this. <br></div><div dir="ltr">lat lon hgt rf<br></div><div dir="ltr">12.57 77.38 919.6 5.6<span class=""><br>12.3 78.18 882.2 67.<br>13.06 77.24 900 0.1<br></span>13.26 77.24 900 4.1<br><br></div><div dir="ltr">If I dont use any function then I get error. <br></div><span class="HOEnZb"><font color="#888888"><div> </div><div>Geeta.</div></font></span><div><div class="h5"> <br><div><br><br></div><div style="display:block"> <div style="font-family:HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,Sans-Serif;font-size:16px"> <div style="font-family:HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,Sans-Serif;font-size:16px"> <div dir="ltr"> <font face="Arial" size="2"> On Wednesday, 14 October 2015 12:34 AM, Mary Haley <<a href="mailto:haley@ucar.edu" target="_blank">haley@ucar.edu</a>> wrote:<br> </font> </div> <br><br> <div><div><div><div dir="ltr"><div style="font-size:small">Geeta,</div><div style="font-size:small"><br clear="none"></div><div style="font-size:small">I'm not sure what you mean by "messy". </div><div style="font-size:small"><br clear="none"></div><div style="font-size:small">You are setting txPosXF and txPosYF, but these resources are meaningless, because the "gsn_add_text" function has the X and Y positions as part of its argument list, in your case, the "lon" and "lat" arguments:</div><div style="font-size:small">
<div> text = <span>gsn_add_text</span>(wks,plot,<span>sprintf</span>(<span>"%9.4g"</span>,rf),lon,lat,txres)</div><div>So, you should be trying to change your lon and lat values, and not txPosXF and txPosYF.</div><div>If by "messy" you mean that the text string is touching the markers in a couple of places, then there are several things you can do.</div><div>One is to simply add some extra spaces before the text strings. You can do this by changing the format in the "sprintf" call to have more fields:</div><div>
</div><div> text = <span>gsn_add_text</span>(wks,plot,<span>sprintf</span>(<span>"%11.4g"</span>,rf),lon,lat,txres)</div><div>or by adding a space:</div><div>
</div><div> text = <span>gsn_add_text</span>(wks,plot," " + <span>sprintf</span>(<span>"%9.4g"</span>,rf),lon,lat,txres)</div><div>You can also add a small delta value to the "lon" position:</div><div>
</div><div> text = <span>gsn_add_text</span>(wks,plot,<span>sprintf</span>(<span>"%9.4g"</span>,rf),lon+0.1,lat,txres)</div><div>--Mary</div><div><br clear="none"></div><div><br clear="none"></div>
<div><br clear="none"></div><div><br clear="none"></div></div></div><div><br clear="none"><div>On Mon, Oct 12, 2015 at 11:14 AM, Geeta Geeta <span dir="ltr"><<a rel="nofollow" shape="rect" href="mailto:geetag54@yahoo.com" target="_blank">geetag54@yahoo.com</a>></span> wrote:<br clear="none"><blockquote style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div><div style="color:#000;background-color:#fff;font-family:HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,Sans-Serif;font-size:16px"><div><span>Hi. <br clear="none"></span></div><div><span>I am plotting station rainfall and my data looks like </span></div><div dir="ltr"><span>13.57 77.38 919.6 5.6<br clear="none">12.3 78.18 882.2 67.<br clear="none">13.06 77.24 900 0.1<br clear="none">13.06 77.24 900 0.1<br clear="none">~ </span></div><div dir="ltr"><span>The Rf is in the 4th Col and it gets plotted. But when I try to change the position of the text, I am unable to do it. <br clear="none"></span></div><div dir="ltr"><span>My script is attached and the Figure. </span></div><div dir="ltr"><br clear="none"><span></span></div><div dir="ltr"><span>essentially, <br clear="none"></span></div><div dir="ltr"><span> <br clear="none"></span></div><div dir="ltr"><span> txres@txPosXF = 0.775<br clear="none"> txres@txPosYF = -5.05<br clear="none">; txres@txAngleF = 40.00 </span></div><div dir="ltr"><br clear="none"><span></span></div><div dir="ltr"><span>Since I am unable to change the above two, my plot looks a little messy. <br clear="none"></span></div><div dir="ltr"><br clear="none"><span></span></div><div dir="ltr"><span>can someone suggest???<span><font color="#888888"><br clear="none"></font></span></span></div><span><font color="#888888"></font></span><div dir="ltr"><span></span></div><div> </div><div>Geeta.</div></div></div></div><br clear="none">_______________________________________________<br clear="none">
ncl-talk mailing list<br clear="none">
<a rel="nofollow" shape="rect" href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a><br clear="none">
List instructions, subscriber options, unsubscribe:<br clear="none">
<a rel="nofollow" shape="rect" href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><br clear="none">
<br clear="none"></blockquote></div><br clear="none"></div></div></div><br><br></div> </div> </div> </div></div></div></div></div></blockquote></div><br></div>