<div dir="ltr"><div class="gmail_default" style="font-size:small">Hi Andrew,</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">You are close. </div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small"> In order for all the polygons to show up, the return value from gsn_add_polygon must be unique.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">You have the gsn_add_polygon call inside a double do loop, and inside of the innermost loop you have:</div><div class="gmail_default">







<p class="gmail-p1" style="font-size:small"><font face="monospace, monospace"><span class="gmail-s1">    </span><span class="gmail-s2">dum2</span><span class="gmail-s1"> = </span><span class="gmail-s3">new</span><span class="gmail-s1">(</span><span class="gmail-s4">dimsizes</span><span class="gmail-s1">(temp_variable_3),</span><span class="gmail-s3">graphic</span><span class="gmail-s1">)</span></font></p><p class="gmail-p1" style="font-size:small"><span class="gmail-s1">and then later:</span></p><p class="gmail-p1" style="font-size:small"><span class="gmail-s1">







</span></p><p class="gmail-p1" style="font-size:small"><font face="monospace, monospace"><span class="gmail-s1">    dum2(a) = </span><span class="gmail-s2">gsn_add_polygon</span><span class="gmail-s1">(wks,plot_without_ygrid,xbar,ybar,bres)</span></font></p><p class="gmail-p1" style="font-size:small">What&#39;s happening is that for each iteration of &quot;a&quot;, dum2 is being reset to an empty array. Any previous calls to gsn_add_polygon have been effectively wiped out.</p><p class="gmail-p1" style="font-size:small">Also, given that you have two do loops, you will need to move this dum2 call to outside of both do loops and make it big enough to accommodate both loops:</p><p class="gmail-p1"><font face="monospace, monospace">ntvar3 = dimsizes(temp_variable_3)<br>nregns = 5<br>dum2   = new((/nregns,ntvar3/),graphic)</font></p><p class="gmail-p1"><font face="monospace, monospace">do i=0,nregns-1 ; loop over regions<br>. . .<br></font></p><p class="gmail-p1"><font face="monospace, monospace">do a=0,ntvar3-1 ; loop over all values for this region                                                            <br></font><span style="font-family:monospace,monospace"> . . .<br></span><span style="font-family:monospace,monospace"> dum2(i,a) = gsn_add_polygon(wks,plot_without_ygrid,xbar,ybar,bres)<br></span><span style="font-family:monospace,monospace">  . . .</span></p><div><font face="monospace, monospace">end do</font></div><div><font face="monospace, monospace">. . .</font></div><div><font face="monospace, monospace">end do</font></div><div><font face="arial, helvetica, sans-serif"><br></font></div><div><font face="arial, helvetica, sans-serif">Another way to do this that doesn&#39;t involve creating a &quot;dum2&quot; variable is to use &quot;unique_string&quot; to create a unique name, and then use this unique name as an attribute to any variable that holds the return value from gsn_add_polygon. I usually use the &quot;plot&quot; variable:</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace"><div> plot@$unique_string(&quot;polygon&quot;)$ = gsn_add_polygon(wks,plot_without_ygrid,xbar,ybar,bres)</div><div><br></div></font></div><div><font face="monospace, monospace"><br></font></div><div>Hopefully by fixing this, your other issues with colors will resolve themselves.</div><div><br></div><div>--Mary</div><div><br></div></div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small"><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Apr 20, 2017 at 4:51 PM, Andrew Kren - NOAA Affiliate <span dir="ltr">&lt;<a href="mailto:andrew.kren@noaa.gov" target="_blank">andrew.kren@noaa.gov</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Dear ncl-talk,<div><br></div><div>I am trying to plot a number of polygons on an xy plot, but for some reason, the polygons are not showing up. The only one that shows up is the last one. Also, the colors don&#39;t seem to work correctly, as they are all red and not varying based on my color array. The other problem is that the plot seems to be plotting twice and I can&#39;t figure out why. Attached is the figure and the program. The program is long so the only issue in the program starts at line 3148 and ends at 3209. </div><div><br></div><div>Thanks much,<span class="HOEnZb"><font color="#888888"><div><div><br></div>-- <br><div class="m_6366571649407855565gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div>Andrew Kren, PhD<br>
Research Scientist I, Global Observing Systems Analysis (GOSA) Group<br>
NOAA ESRL Global Systems Division (Rm 3C515)<br>
325 Broadway, Boulder, CO 80305<br>
<a href="tel:%28303%29%20497-5418" value="+13034975847" target="_blank">(303) 497-5418</a><span><font color="#888888"><br>
</font></span></div></div></div></div></div></div></div></div></div></div></div></div></div></div>
</div></font></span></div></div>
<br>______________________________<wbr>_________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@ucar.edu">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/<wbr>mailman/listinfo/ncl-talk</a><br>
<br></blockquote></div><br></div>