[ncl-talk] Error bars

Mary Haley haley at ucar.edu
Thu Jul 24 09:05:39 MDT 2014


Hi Guilherme,

Sorry about the delay in response.  The issue is simply that you need to
make sure that when you call gsn_add_polyxxxx, the variable on the left
side of the "=" is unique every time.

Usually when you see this type of error:

warning:TransformPreDraw: tfPolyDrawList element 127 is invalid

it has to do with the variable not being unique.

You almost had it, as you defined "error_bars" and "centers" as "id"
arrays.  But, these are defined inside of a larger loop across "i", and so
every time you go through another iteration of "i", the old error_bars and
centers ids were getting clobbered and reset.

One way around this is to not predefine any arrays at all, and instead just
create a dummy attribute that you can attach to "plot", and make sure this
dummy attribute has a unique name every time.  Here's one way to do that:

    tmp_str = "centers" + i*10 + t   ; give attr a unique name
    plot@$tmp_str$   = gsn_add_polymarker(wks,plot(0,0),t,pin_n(t),polyres)
    tmp_str = "error_bar" + i*10 + t
    plot@$tmp_str$ =
gsn_add_polyline(wks,plot(0,0),(/t,t/),(/pin_n(t)+stddev(p
in_n),pin_n(t)-stddev(pin_n)/),polyres)

--Mary



On Mon, Jul 21, 2014 at 11:52 AM, Guilherme Martins <jgmsantos at gmail.com>
wrote:

> Hi all,
>
> I'm trying to plot the error bars following the example:
>
> http://www.ncl.ucar.edu/Applications/Scripts/xy_13.ncl
>
> The bars are ok, but I have the error:
>
> fatal:Number of dimensions in parameter (0) of (NhlAddPrimitive) is (2),
> (1) dimensions were expected
>
> When insert the error bars.
>
> I'm using NCL 6.2.0. My files are in attached.
>
> Guilherme.
>
> --
> https://sites.google.com/site/jgmsantos/
>
>
> _______________________________________________
> ncl-talk mailing list
> 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/20140724/b405b498/attachment.html 


More information about the ncl-talk mailing list