[ncl-talk] Problem using gsn_add_polyline twice

Rick Brownrigg brownrig at ucar.edu
Thu Jan 30 07:14:12 MST 2020


Yea, looking at your plots, I agree with your assessment. The docs for
gsn_csm_xy2 state this about the return value (which you're assigning to
"plot"):

    http://ncl.ucar.edu/Document/Graphics/Interfaces/gsn_csm_xy2.shtml
Return value

The return value is the scalar id of the first XY plot created.

The scalar id of the second XY plot is returned as an attribute called
"xy2". This attribute or the return value can be used in calls to functions
like *gsn_add_polymarker*
<http://ncl.ucar.edu/Document/Graphics/Interfaces/gsn_add_polymarker.shtml>
or *gsn_add_polyline*
<http://ncl.ucar.edu/Document/Graphics/Interfaces/gsn_add_polyline.shtml>
to add primitives to either plot.

The id of the data object is returned as an attribute called *data*. This
is useful if you want to use setvalues
<http://ncl.ucar.edu/Document/Manuals/Ref_Manual/NclStatements.shtml#Setvalues>
to change some data options after this function has been called.

- - - - - - - -

Perhaps  try passing in "plot at xy2" rather than just "plot" in the second
call to gsn_add_polyline()

HTH,

Rick





On Thu, Jan 30, 2020 at 6:14 AM Anne via ncl-talk <ncl-talk at ucar.edu> wrote:

> Hi NCL users,
>
> I have a xy-plot consisting of 2 y-axes, and I am using gsn_csm_xy2 for
> this purpose, each axis having a set of lines. For both sets of y lines, I
> want to overlay the mean of those lines by using gsn_add_polyline. This
> works fine for the one set of lines, but the mean for the 2nd data set is
> false because it is oriented on the left axis instead of the right axis as
> it should be (see plots attached). How can I overcome this issue?
> I have attached the script and the pots.
> When I plot only 1 set of lines, so using 1 y-axis, then the overlying
> works fine.
> My guess is that NCL gets confused using gsn_add_polyline twice, and it
> aligns both additional lines at the left axis.
>
> Anyone has any experience with this?
>
> Thank you
> Anne
>
> _______________________________________________
> 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/20200130/1a0597de/attachment.html>


More information about the ncl-talk mailing list