<div dir="ltr"><div class="gmail_default" style="font-size:small">Hi Cheung,</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">Thanks for providing the script offline.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">It was definitely the filled bars that were causing the tfPolyDraw errors. The issue is that you are creating these plots inside of a function, and each of the plot objects has a number of attributes attached that represent the filled bars. When the function is done, all of those attributes get deleted, and hence the errors and the lack of color in the bars.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">You have to assure that all of those attributes "live" outside the function. I know this is a pain, but it's a simple fix. Add these three lines before you call "return(plot)" in "wrap_xy_plot_bar":</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small"><div class="gmail_default"> copy_VarAtts(plot1,plot)</div><div class="gmail_default"> copy_VarAtts(plot2,plot)</div><div class="gmail_default"> copy_VarAtts(plot3,plot)</div><div><br></div><div>--Mary</div><div><br></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Mar 8, 2017 at 8:56 AM, Mary Haley <span dir="ltr"><<a href="mailto:haley@ucar.edu" target="_blank">haley@ucar.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_default" style="font-size:small">Hi Cheung,</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">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. </div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">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.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">So, the issue could be on our end.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">Can you send me your script? You can do this offline.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">Thanks,</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">--Mary</div><div class="gmail_default" style="font-size:small"><br></div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Mar 7, 2017 at 7:39 PM, Cheung <span dir="ltr"><<a href="mailto:zuibeidemei@126.com" target="_blank">zuibeidemei@126.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="line-height:1.7;color:#000000;font-size:14px;font-family:Arial"> Hi Mary, thanks for your reply.<br><br> I did not use any function like gsn_add_polyxx or gsn_add_text, which can be handled as in the FAQ.<br><br> In my case, I use the procedure "overlay" to overlay several plots on a base plot,<br><br> as in this function a. The problem is that the "res for plot1" and "res for plot2"<br><br> are forgotten. The warning will persist even if "res for plot1" and "res for plot2"<br><br> are commented. They only disappear when I comment the "overlay" procedure.<span><br><br> function a<br> <br> rex@xxx = xxx<br> plot = gsn_csm_xy(wks,x,y,res)<br><br> res@xxx = xxx ; call this as "res for plot1"<br> plot1 = gsn_csm_xy(wks,x,y,res)<br> res@xxx = xxx ; call this as "res for plot2"<br> plot2 = gsn_csm_xy(wks,x,y,res)<br> <br> overlay(plot,plot1)<br> overlay(plot,plot2)<br> return(plot)<br><br>end function a<br><br><br><br><br><div style="zoom:1"></div><div id="m_3293755291210587399m_2516205959250285866divNeteaseMailCard"></div><br></span><div><div class="m_3293755291210587399h5">At 2017-03-07 23:36:31, "Mary Haley" <<a href="mailto:haley@ucar.edu" target="_blank">haley@ucar.edu</a>> wrote:<br> <blockquote id="m_3293755291210587399m_2516205959250285866isReplyContent" style="PADDING-LEFT:1ex;MARGIN:0px 0px 0px 0.8ex;BORDER-LEFT:#ccc 1px solid"><div dir="ltr"><div class="gmail_default" style="font-size:small">Cheung,</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">See:</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default"><a href="http://www.ncl.ucar.edu/FAQ/#err_msgs_027" target="_blank">http://www.ncl.ucar.edu/FAQ/#e<wbr>rr_msgs_027<br></a></div><div class="gmail_default"><br></div><div class="gmail_default">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.</div><div class="gmail_default"><br></div><div class="gmail_default">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.</div><div class="gmail_default"><br></div><div class="gmail_default">--Mary</div><div class="gmail_default"><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Mar 7, 2017 at 7:44 AM, Cheung <span dir="ltr"><<a href="mailto:zuibeidemei@126.com" target="_blank">zuibeidemei@126.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="line-height:1.7;color:#000000;font-size:14px;font-family:Arial"><div><i><b>Dear NCL:</b></i></div><div><br></div><div><i><b> I use a function to generate certain type of plot.</b></i></div><div><i><b> Inside this function, several plots are overlaid on a base plot, like this:</b></i></div><div><br></div><div><i><b> function a</b></i></div><div><i><b> </b></i></div><div><i><b> rex@xxx = xxx</b></i></div><div><i><b> plot = gsn_csm_xy(wks,x,y,res)</b></i></div><div><i><b> res@xxx = xxx ; call this as "res for plot1"</b></i></div><div><i><b> plot1 = gsn_csm_xy(wks,x,y,res)</b></i></div><div><i><b> res@xxx = xxx ; call this as "res for plot2"</b></i></div><div><i><b> plot2 = gsn_csm_xy(wks,x,y,res)</b></i></div><div><i><b> overlay(plot,plot1)</b></i></div><div><i><b> overlay(plot,plot2)</b></i></div><div><i><b> return(plot)</b></i></div><div><br></div><div><i><b>end function a</b></i></div><div><br></div><div><i><b> Such codes will generate "warning TransformPreDraw: tfPolyDrawList element 0".</b></i></div><div><i><b> Although plot1 and plot 2 can be overlaid to the base plot when this function a is called, </b></i></div><div><i><b> the resultant plot lose all "res for plot1, 2". </b></i><i><b>I guess this is because the new "res" are not </b></i></div><div><i><b> "alive" when this plot is returned. </b></i><i><b>Is there any way to solve this?</b></i></div><div><br></div><div><i><b> Thanks for your help.</b></i></div><div><br></div><div><i><b>Best</b></i></div><span class="m_3293755291210587399m_2516205959250285866HOEnZb"><font color="#888888"><div><i><b>Cheung</b></i></div><div><i><b> </b></i></div><div> </div></font></span></div><br><br><span title="neteasefooter"><p> </p></span><br>______________________________<wbr>_________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a><br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">http://mailman.ucar.edu/mailma<wbr>n/listinfo/ncl-talk</a><br>
<br></blockquote></div><br></div>
</blockquote></div></div></div><br><br><span title="neteasefooter"><p> </p></span></blockquote></div><br></div>
</div></div></blockquote></div><br></div>