<div dir="ltr"><div>Yes, I did make a mistake and wrote it to convert panels into phases, not the other way around. While this isn't as fancy, the below should work. Perhaps redundant and less pretty considering the simplicity of the first method, but I'll still share it to complete the conversation of doing it in the loop.</div>
<div><br></div><div>Initialize panel_idx = 0 before the loop.</div><div><br></div><div>In the loop, include these lines at the end of the loop. The 'if' will reset for the second column.</div><div><br></div><div>
panel_idx = panel_idx + 2</div>
<div>if(phase.eq.4)</div><div> panel_idx = 1</div><div>end</div><div><br></div><div><br></div><div><br></div><div>Phase number:<br><div><br></div><div>---1-----5---</div><div>---2-----6---</div><div>---3-----7---</div><div>
---4-----8---</div></div><div><br></div><div>Panel number:</div><div><br></div><div>---0-----1---</div><div>---2-----3---</div><div>---4-----5---</div><div>---6-----7---</div><div><br></div><div>As I see it, your math just needs to yield:</div>
<div><br></div><div>Phase 1 - Panel 0</div><div>Phase 2 - Panel 2</div><div>Phase 3 - Panel 4</div><div>Phase 4 - Panel 6</div><div>Phase 5 - Panel 1</div><div>Phase 6 - Panel 3</div><div>Phase 7 - Panel 5</div><div>Phase 8 - Panel 7</div>
<div><br></div><div><br></div><div>Kyle</div></div><div class="gmail_extra"><br clear="all"><div><div dir="ltr">----------------------------------------<div>Kyle S. Griffin</div><div>Department of Atmospheric and Oceanic Sciences</div>
<div>University of Wisconsin - Madison</div><div>Room 1421</div><div>1225 W Dayton St, Madison, WI 53706</div><div>Email: <a href="mailto:ksgriffin2@wisc.edu" target="_blank">ksgriffin2@wisc.edu</a></div></div></div>
<br><br><div class="gmail_quote">On Wed, Aug 6, 2014 at 1:12 PM, WU, Cheuk Kuen <span dir="ltr"><<a href="mailto:hkson@connect.hku.hk" target="_blank">hkson@connect.hku.hk</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>Oh! Thank you so much! The first way you suggest is really simple but I have never thought of it. How stupid I am! (Although I am still a newbie, but I have been using <br>NCL for about a month.) I will try it when I back to office in the morning. <br>
<br></div><div>But I don't understand how method 2 works. I used phase 5 as an example. The expected panel_idx should be 1, but ((5-1)%2*4)+((5-1)/2) = 0+2 = 2??<br>Can you explain the expression a bit? Thanks!<br><br>
</div><div>P.S.: I am sorry that I did not reply to ncl-talk in the previous e-mail as that is my first time replying a post here. I will remember to do so from now. Thanks :)<br></div><div><br></div><div>John<br></div></div>
<div class="HOEnZb"><div class="h5">
<div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Aug 7, 2014 at 1:40 AM, Kyle Griffin <span dir="ltr"><<a href="mailto:ksgriffin2@wisc.edu" target="_blank">ksgriffin2@wisc.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">There are a couple ways you can do this in the looping sense. You can re-arrange the plots in the gsn_panel call...<div>
<br></div><div>gsn_panel(wks,(/plotpanel(0),plotpanel(4),plotpanel(1),plotpanel(5),..../),(/4,2/),pres)</div>
<div><br></div><div>Or you could devise a counter that would handle this alternation with a bit of math, and then just assign each plot to the graphics array per its panel index.</div><div><br></div><div>panel_idx = ((phase-1)%2*4)+((phase-1)/2)</div>
<div>plotpanel(panel_idx) = plot</div><div><br></div><div><br></div><div>P.S. make sure ncl-talk is in your reply-to when you respond (usually a reply-all works just fine), just so everyone can keep up with the conversation and others can help as well.</div>
<span><font color="#888888">
<div><br></div><div><br></div><div>Kyle</div></font></span></div><div class="gmail_extra"><div><br clear="all"><div><div dir="ltr">----------------------------------------<div>Kyle S. Griffin</div><div>Department of Atmospheric and Oceanic Sciences</div>
<div>University of Wisconsin - Madison</div><div>Room 1421</div><div>1225 W Dayton St, Madison, WI 53706</div><div>Email: <a href="mailto:ksgriffin2@wisc.edu" target="_blank">ksgriffin2@wisc.edu</a></div></div></div>
<br><br></div><div><div><div class="gmail_quote">On Wed, Aug 6, 2014 at 12:31 PM, WU, Cheuk Kuen <span dir="ltr"><<a href="mailto:hkson@connect.hku.hk" target="_blank">hkson@connect.hku.hk</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><div>Thanks. Actually I am using a do loop from phase = 1 to 8 to plot them:<br><br></div><div>if phase.eq.1 then<br></div>plotpanel = new(8,graphic)<br></div>end if<br><div><div>plotpanel(phase-1) = plot ("plot" is the individual plot within the do loop and it will be replaced by the plot of the next phase during the loop)<br>
<br></div><div>Therefore I think I can't easily change my code and use the way you suggested, although your method is really fast and smart. Any opinions?<br><br></div><div>John<br></div></div></div><div>
<div><div class="gmail_extra">
<br><br><div class="gmail_quote">On Thu, Aug 7, 2014 at 1:03 AM, Kyle Griffin <span dir="ltr"><<a href="mailto:ksgriffin2@wisc.edu" target="_blank">ksgriffin2@wisc.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">Change the order with which you store the plots in the array that is called in gsn_panel.<div><br></div><div>phases = new(8,graphic)</div><div>phases(0) = phase1plot</div><div>phases(1) = phase5plot</div><div>
phases(2) = phase2plot</div><div>phases(3) = phase6plot</div><div>...and so on for all 8.</div><div><br></div><div>You'll also have to re-arrange your text annotations (such as labeling each as panel a and b) if you are setting any in the panel resources.</div>
<div><br></div><div><br></div><div>Kyle</div><div><br></div></div><div class="gmail_extra"><br clear="all"><div><div dir="ltr">----------------------------------------<div>Kyle S. Griffin</div><div>Department of Atmospheric and Oceanic Sciences</div>
<div>University of Wisconsin - Madison</div><div>Room 1421</div><div>1225 W Dayton St, Madison, WI 53706</div><div>Email: <a href="mailto:ksgriffin2@wisc.edu" target="_blank">ksgriffin2@wisc.edu</a></div></div></div>
<br><br><div class="gmail_quote"><div><div>On Wed, Aug 6, 2014 at 11:56 AM, WU, Cheuk Kuen <span dir="ltr"><<a href="mailto:hkson@connect.hku.hk" target="_blank">hkson@connect.hku.hk</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>
<div dir="ltr">Hi,<br><br>I am doing an MJO study. I am plotting the mean geopotential height and wind vector anomalies in different phases of MJO. I plotted all the individual plots, and even tried to do a panel plot. However, the finished panel plot draws the individual plots from left to right, top to bottom, like:<br>
<br>Phase1 Phase2<br>Phase3 Phase4<br>Phase5 Phase6<br>Phase7 Phase8<br><br>I want to plot them from top to bottom, left to right, like:<br>Phase1 Phase5<br>Phase2 Phase6<br>Phase3 Phase7<br>Phase4 Phase8<br><br>However, I cannot find useful information on the Internet. The most relevant one is <a href="http://www.ncl.ucar.edu/Applications/Scripts/panel_12.ncl" target="_blank">http://www.ncl.ucar.edu/Applications/Scripts/panel_12.ncl</a> this one. I thought to plot phases1-4 as the first (left) panel, and phases 5-8 as the second (right) panel. But I have the common label bar and title for all 8 plots and I don't want them to appear twice, and I want to place them in the center but not only left or right. Is there a convenient way to draw the plots in the way I want, i.e. from top to bottom, left to right with only one common title and label bar in the centre?<br>
<br>Regards,<br>John<br></div>
<br></div></div>_______________________________________________<br>
ncl-talk mailing list<br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><br>
<br></blockquote></div><br></div>
</blockquote></div><br></div>
</div></div></blockquote></div><br></div></div></div>
</blockquote></div><br></div>
</div></div></blockquote></div><br></div>