[ncl-talk] gsn_add_text on bar chart

Rick Brownrigg brownrig at ucar.edu
Thu Apr 2 09:38:35 MDT 2020


I think argument 2 is actually the third argument (zero-based numbering),
and if so, its complaining that the variables "aa" and "dd" are of type
integer, whereas type string is expected. Try wrapping them in tostring(),
like:

   dum1(i) = gsn_add_text(wks,plot1,tostring(aa(i)),0.20,0.90,txres)
    dum2(i) = gsn_add_text(wks,plot2,tostring(dd(i)),0.20,0.90,txres)

That said, the message was just a warning, and there are some other issues.
As with any of the gsn_add_xxxx() functions, you'll need to add these two
resources:

  res at gsnDraw  = False
  res at gsnFrame = False

and then follow the loop containing the gsn_add_text calls with something
like:

  draw(plot1)
  frame(wks)
  draw(plot2)
  frame(wks)

Hope that helps,
Rick


On Thu, Apr 2, 2020 at 9:15 AM Vanúcia Schumacher via ncl-talk <
ncl-talk at ucar.edu> wrote:

> Hi NCL users
>
> I am using the example of bar chart "unique_5.ncl" (attachment) and I
> would like to add caption text to each bar, but the following warning
> returns.
>
> warning: Argument 2 of the current function or procedure was coerced to
> the appropriate type and thus will not change if the function or procedure
> modifies its value
>
> Does anyone have a guess as could add in this example?
>
> Thanks
>
>
> _______________________________________________
> 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/20200402/ce2289c1/attachment.html>


More information about the ncl-talk mailing list