[ncl-talk] markers with different colors
Mary Haley
haley at ucar.edu
Thu Oct 22 16:03:42 MDT 2015
[Please don't CC me on questions that are sent to ncl-talk. I'm on
ncl-talk, so I will see your follow-up messages.]
You need to have a unique identifier for each time you call gsn_add_xxxxx.
The easiest way to do this, without having to predefine an array to hold
all the objects, is to use unique_string to generate a unique string name,
and then use this string name as an attribute name.
So, instead of:
dum =gsn_add_polymarker(wks,plot,lon,lat,res_mark)
use:
str = unique_string("poly")
plot@$str$ = gsn_add_polymarker(wks,plot,lon,lat,res_mark)
--Mary
On Thu, Oct 22, 2015 at 12:37 PM, Geeta Geeta <geetag54 at yahoo.com> wrote:
> Hi all.
> I was trying to give a different color to the rainfall range (value)
> recently. My actual data is some 300+ stations an when I run that script,
> the plot was all crowded .
>
> I thought of giving a different color to the marker itself without adding
> the text/rainfall value to the plot.
> here is that part
> ;---------Adding Markers according to rainfall value
>
> nrf = dimsizes(rf)
> markers = new(dimsizes(rf),string)
> dont_mark = "red"
>
> res_mark = True
> res_mark at gsMarkerIndex = 1 ; 17 predefined markers available
> res_mark at gsMarkerSizeF = 0.012
> ; res_mark at gsMarkerColor = "black"
>
> do n = 0, nrf-1
> if (rf(n).eq.0.0) then
> res_mark at gsMarkerColor = "Black"
> ; dum =gsn_add_polymarker(wks,plot,lon,lat,res_mark)
>
> else if ((rf(n).ge.0.1).and.(rf(n).lt.2.4)) then
> res_mark at gsMarkerColor = "Blue"
>
> else if ((rf(n).ge.2.5).and.(rf(n).lt.7.5)) then
> res_mark at gsMarkerColor = "Red"
> end if
> end if
> end if
> ; end do
>
> dum =gsn_add_polymarker(wks,plot,lon,lat,res_mark)
> end do
> print(rf+res_mark at gsMarkerColor)
>
> ; ----------Now adding text--------------------
> I get warning like this and the Plot has Only Black markers????
> warning:TransformPostDraw: tfPolyDrawList element 273 is invalid
> warning:TransformPostDraw: tfPolyDrawList element 274 is invalid
> warning:TransformPostDraw: tfPolyDrawList element 275 is invalid
> warning:TransformPostDraw: tfPolyDrawList element 276 is invalid
> warning:TransformPostDraw: tfPolyDrawList element 277 is invalid
> warning:TransformPostDraw: tfPolyDrawList element 278 is invalid
> warning:TransformPostDraw: tfPolyDrawList element 279 is invalid
> warning:TransformPostDraw: tfPolyDrawList element 280 is invalid
> warning:TransformPostDraw: tfPolyDrawList element 281 is invalid
> warning:TransformPostDraw: tfPolyDrawList element 282 is invalid
> warning:TransformPostDraw: tfPolyDrawList element 283 is invalid
> warning:TransformPostDraw: tfPolyDrawList element 284 is invalid
> warning:TransformPostDraw: tfPolyDrawList element 285 is invalid
> warning:TransformPostDraw: tfPolyDrawList element 286 is invalid
> warning:TransformPostDraw: tfPolyDrawList element 287 is invalid
> warning:TransformPostDraw: tfPolyDrawList element 288 is invalid
> warning:TransformPostDraw: tfPolyDrawList element 289 is invalid
> warning:TransformPostDraw: tfPolyDrawList element 290 is invalid
> warning:TransformPostDraw: tfPolyDrawList element 291 is invalid
> warning:TransformPostDraw: tfPolyDrawList element 292 is invalid
> warning:TransformPostDraw: tfPolyDrawList element 293 is invalid
> aditya at agniilap:~/geeta/ncl$
> kindly suggest.
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20151022/9cae9471/attachment.html
More information about the ncl-talk
mailing list