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

Cheung zuibeidemei at 126.com
Tue Mar 7 07:44:46 MST 2017


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
      
                 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20170307/d13ad484/attachment.html 


More information about the ncl-talk mailing list