[ncl-talk] How to remember the overlaid plot inside a function

Mary Haley haley at ucar.edu
Wed Mar 8 08:56:27 MST 2017


Hi Cheung,

It may be possible that you are creating a plot that has some internal
calls to gsn_add_polyxxx or gsn_add_text under the hood.

For example, if you were doing a bar chart, or filling between two curves,
then internally this uses gsn_add_polygon to fill the bars.

So, the issue could be on our end.

Can you send me your script? You can do this offline.

Thanks,

--Mary


On Tue, Mar 7, 2017 at 7:39 PM, Cheung <zuibeidemei at 126.com> wrote:

>            Hi Mary, thanks for your reply.
>
>       I did not use any function like gsn_add_polyxx or gsn_add_text,
> which can be handled as in the FAQ.
>
>       In my case, I  use the procedure "overlay" to overlay several plots
> on a base plot,
>
>       as in this function a. The problem is that the "res for plot1" and
> "res for plot2"
>
>       are forgotten. The warning will persist even if "res for plot1" and
> "res for plot2"
>
>      are commented. They only disappear when I comment the "overlay"
> procedure.
>
>  function a
>
>                    rex at xxx           = xxx
>                    plot                   = gsn_csm_xy(wks,x,y,res)
>
>                    res at xxx           = xxx      ; call this as "res for
> plot1"
>                    plot1                 = gsn_csm_xy(wks,x,y,res)
>                    res at xxx           = xxx       ; call this as "res for
> plot2"
>                    plot2                 = gsn_csm_xy(wks,x,y,res)
>
>                    overlay(plot,plot1)
>                    overlay(plot,plot2)
>                    return(plot)
>
> end function a
>
>
>
>
>
> At 2017-03-07 23:36:31, "Mary Haley" <haley at ucar.edu> wrote:
>
> Cheung,
>
> See:
>
> http://www.ncl.ucar.edu/FAQ/#err_msgs_027
>
> When you get warnings about "tfPolyDrawList", this should have to do with
> code where you are attaching polylines, polygons, polymarkers, or text to a
> plot, and not in the creation of the plot itself.
>
> Do you have any code where you are calling gsn_add_polyxxxx or
> gsn_add_text? If so, then please read the above FAQ question about how to
> make sure your return values for each call are unique.
>
> --Mary
>
>
> On Tue, Mar 7, 2017 at 7:44 AM, Cheung <zuibeidemei at 126.com> wrote:
>
>> *Dear NCL:*
>>
>> *                   I use a function to generate certain type of plot.*
>> *                   Inside this function, several plots are overlaid on a
>> base plot, like this:*
>>
>> * function a*
>>
>> *                   rex at xxx           = xxx*
>> *                   plot                   = gsn_csm_xy(wks,x,y,res)*
>> *                   res at xxx           = xxx      ; call this as "res for
>> plot1"*
>> *                   plot1                 = gsn_csm_xy(wks,x,y,res)*
>> *                   res at xxx           = xxx       ; call this as "res for
>> plot2"*
>> *                   plot2                 = gsn_csm_xy(wks,x,y,res)*
>> *                   overlay(plot,plot1)*
>> *                   overlay(plot,plot2)*
>> *                   return(plot)*
>>
>> *end function a*
>>
>> *                    Such codes will generate "warning TransformPreDraw:
>> tfPolyDrawList element 0".*
>> *                    Although plot1 and plot 2 can be overlaid to the
>> base plot when this function a is called, *
>> *                    the resultant plot lose all "res for plot1, 2". **I
>> guess this is because the new "res" are not *
>> *                   "alive" when this plot is returned. **Is there any
>> way to solve this?*
>>
>> *                    Thanks for your help.*
>>
>> *Best*
>> *Cheung*
>>
>>
>>
>>
>>
>>
>> _______________________________________________
>> 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/20170308/a5c0f7f1/attachment.html 


More information about the ncl-talk mailing list