Dear All,
I am trying to attach lots of number strings to a plot by using gsn_add_text. I want to adjust the color of each string according to their value, i.e. warmer colors for greater numbers (please see attached image). The problem is, since the resource txFontColor can only be assigned a single value and not an array, I have to construct a do loop which changes the value of txFontColor each time. And this takes VERY long, as there are 363 strings to attach to the plot.
Code snippet for the long loop:
txres=True
text = new(dimsizes(dolu),graphic);
iSize = dimsizes(dolu) - 1
do i=0, iSize
deger=temp_dolu(i)
sira=dolu(i)
if (deger.lt.maxsic).and.(deger.gt.minsic) then
txres@txFontColor = 2 + floattoint((deger-minsic)*incr)
text(i) = gsn_add_text(wks,map,sprintf("%6.4g",round(deger,0)),x(sira),y(sira),txres) ; Add the number texts
end if
end do
Instead, I tried:
txres@txFontColor = 2 + floattoint((temp_dolu-minsic)*incr)
text = gsn_add_text(wks,map,sprintf("%6.4g",round(temp_dolu,0)),x(dolu),y(dolu),txres)
where temp_dolu is the temperature array that I try to put on the map. This gives no error, but txFontColor takes the first value of the array that is assigned, so all my numbers on the map are the same color.
Can you kindly suggest any other (fast) ways of accomplishing this? You can maybe tell me where in the source code I can change the behavior of txFontColor, so that it takes on arrays as well?
Thanks in advance,
Ozan
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
This archive was generated by hypermail 2.1.8 : Mon Jun 25 2012 - 09:57:23 MDT