<div dir="ltr">I figured it out Mary!</div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Apr 21, 2017 at 8:47 AM, Andrew Kren - NOAA Affiliate <span dir="ltr"><<a href="mailto:andrew.kren@noaa.gov" target="_blank">andrew.kren@noaa.gov</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">Thanks Mary. I got my bars to show up now and my colors are plotting corrrectly. I still have the issue of the plot showing up twice on top of itself. Do you know why that could be? I am looking it over as I email this, but currently can't figure it out. Also, I can't figure out why the X reference line does not show up. See attached.<div><br></div><div>Thanks for your help,</div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Apr 20, 2017 at 5:30 PM, 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 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="m_-1279812130970264271m_-7367154439480803552gmail-p1" style="font-size:small"><font face="monospace, monospace"><span class="m_-1279812130970264271m_-7367154439480803552gmail-s1"> </span><span class="m_-1279812130970264271m_-7367154439480803552gmail-s2">dum2</span><span class="m_-1279812130970264271m_-7367154439480803552gmail-s1"> = </span><span class="m_-1279812130970264271m_-7367154439480803552gmail-s3">new</span><span class="m_-1279812130970264271m_-7367154439480803552gmail-s1">(</span><span class="m_-1279812130970264271m_-7367154439480803552gmail-s4">dimsizes</span><span class="m_-1279812130970264271m_-7367154439480803552gmail-s1">(temp_variable_3),</span><span class="m_-1279812130970264271m_-7367154439480803552gmail-s3"><wbr>graphic</span><span class="m_-1279812130970264271m_-7367154439480803552gmail-s1">)</span></font></p><p class="m_-1279812130970264271m_-7367154439480803552gmail-p1" style="font-size:small"><span class="m_-1279812130970264271m_-7367154439480803552gmail-s1">and then later:</span></p><p class="m_-1279812130970264271m_-7367154439480803552gmail-p1" style="font-size:small"><span class="m_-1279812130970264271m_-7367154439480803552gmail-s1">
</span></p><p class="m_-1279812130970264271m_-7367154439480803552gmail-p1" style="font-size:small"><font face="monospace, monospace"><span class="m_-1279812130970264271m_-7367154439480803552gmail-s1"> dum2(a) = </span><span class="m_-1279812130970264271m_-7367154439480803552gmail-s2">gsn_add_polygon</span><span class="m_-1279812130970264271m_-7367154439480803552gmail-s1">(wks,plot_witho<wbr>ut_ygrid,xbar,ybar,bres)</span></font></p><p class="m_-1279812130970264271m_-7367154439480803552gmail-p1" style="font-size:small">What's happening is that for each iteration of "a", dum2 is being reset to an empty array. Any previous calls to gsn_add_polygon have been effectively wiped out.</p><p class="m_-1279812130970264271m_-7367154439480803552gmail-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="m_-1279812130970264271m_-7367154439480803552gmail-p1"><font face="monospace, monospace">ntvar3 = dimsizes(temp_variable_3)<br>nregns = 5<br>dum2 = new((/nregns,ntvar3/),graphic)</font></p><p class="m_-1279812130970264271m_-7367154439480803552gmail-p1"><font face="monospace, monospace">do i=0,nregns-1 ; loop over regions<br>. . .<br></font></p><p class="m_-1279812130970264271m_-7367154439480803552gmail-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_witho<wbr>ut_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't involve creating a "dum2" variable is to use "unique_string" 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 "plot" variable:</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace"><div> plot@$unique_string("polygon"<wbr>)$ = gsn_add_polygon(wks,plot_witho<wbr>ut_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"><div><div class="m_-1279812130970264271h5">On Thu, Apr 20, 2017 at 4:51 PM, Andrew Kren - NOAA Affiliate <span dir="ltr"><<a href="mailto:andrew.kren@noaa.gov" target="_blank">andrew.kren@noaa.gov</a>></span> wrote:<br></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="m_-1279812130970264271h5"><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'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'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="m_-1279812130970264271m_-7367154439480803552HOEnZb"><font color="#888888"><div><div><br></div>-- <br><div class="m_-1279812130970264271m_-7367154439480803552m_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></div></div>______________________________<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><br><br clear="all"><div><br></div>-- <br><div class="m_-1279812130970264271gmail_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>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_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>