[ncl-talk] text res

Geeta Geeta geetag54 at yahoo.com
Thu Oct 15 11:49:13 MDT 2015


Yes I meant "clumsy " as the values close to the dots. 
Yes all your suggestions are working very well. 
Thanks a lot for that. 

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
if 2.5  -10.0 say then I write the actual value by Green color
Instead of all uniform colour like Blue I have chosen  

For this I tried with if statement before the Text Res like this. 

  txres                    = True
  txres at txFontHeightF      = 0.012
  txres at txFont             = "helvetica-bold"
;
    if any(rf.le.4.1) then
  txres at txFontColor        = "Blue"
;  txres at txFontQuality      = "High"
;  txres at txJut             = "TopRight "
else
if any(rf.gt.4.1) then
txres at txFontColor        = "Red"
end if
end if
  
  text  = gsn_add_text(wks,plot,"  "+sprintf("%9.4g",rf),lon,lat,txres)

But It is plotted in Blue only. 
my input file looks like this. 
lat         lon        hgt      rf
12.57   77.38   919.6  5.6
12.3    78.18   882.2  67.
13.06   77.24   900    0.1
13.26   77.24   900    4.1

If I dont use any function then I get error. 
 Geeta. 


     On Wednesday, 14 October 2015 12:34 AM, Mary Haley <haley at ucar.edu> wrote:
   

 Geeta,
I'm not sure what you mean by "messy".  
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:  text  = gsn_add_text(wks,plot,sprintf("%9.4g",rf),lon,lat,txres)So, you should be trying to change your lon and lat values, and not txPosXF and txPosYF.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.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:  text  = gsn_add_text(wks,plot,sprintf("%11.4g",rf),lon,lat,txres)or by adding a space:  text  = gsn_add_text(wks,plot,"  " + sprintf("%9.4g",rf),lon,lat,txres)You can also add a small delta value to the "lon" position:  text  = gsn_add_text(wks,plot,sprintf("%9.4g",rf),lon+0.1,lat,txres)--Mary




On Mon, Oct 12, 2015 at 11:14 AM, Geeta Geeta <geetag54 at yahoo.com> wrote:

Hi. 
I am plotting station rainfall and my data looks like 13.57   77.38   919.6  5.6
12.3    78.18   882.2  67.
13.06   77.24   900    0.1
13.06   77.24   900    0.1
~                           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. 
My script is attached and the Figure. 
essentially, 
  
  txres at txPosXF            = 0.775
  txres at txPosYF            = -5.05
;  txres at txAngleF           = 40.00 
Since I am unable to change the above two, my plot looks a little messy. 

can someone suggest???
 Geeta.
_______________________________________________
ncl-talk mailing list
ncl-talk at ucar.edu
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk





  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20151015/43ae6522/attachment.html 


More information about the ncl-talk mailing list