[ncl-talk] Panel plots direction (top to bottom first, then left to right)

WU, Cheuk Kuen hkson at connect.hku.hk
Wed Aug 6 12:12:53 MDT 2014


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
NCL for about a month.) I will try it when I back to office in the morning.

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??
Can you explain the expression a bit? Thanks!

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 :)

John


On Thu, Aug 7, 2014 at 1:40 AM, Kyle Griffin <ksgriffin2 at wisc.edu> wrote:

> There are a couple ways you can do this in the looping sense. You can
> re-arrange the plots in the gsn_panel call...
>
>
> gsn_panel(wks,(/plotpanel(0),plotpanel(4),plotpanel(1),plotpanel(5),..../),(/4,2/),pres)
>
> 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.
>
> panel_idx = ((phase-1)%2*4)+((phase-1)/2)
> plotpanel(panel_idx) = plot
>
>
> 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.
>
>
> Kyle
>
> ----------------------------------------
> Kyle S. Griffin
> Department of Atmospheric and Oceanic Sciences
> University of Wisconsin - Madison
> Room 1421
> 1225 W Dayton St, Madison, WI 53706
> Email: ksgriffin2 at wisc.edu
>
>
> On Wed, Aug 6, 2014 at 12:31 PM, WU, Cheuk Kuen <hkson at connect.hku.hk>
> wrote:
>
>> Thanks. Actually I am using a do loop from phase = 1 to 8 to plot them:
>>
>> if phase.eq.1 then
>> plotpanel = new(8,graphic)
>> end if
>> 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)
>>
>> 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?
>>
>> John
>>
>>
>> On Thu, Aug 7, 2014 at 1:03 AM, Kyle Griffin <ksgriffin2 at wisc.edu> wrote:
>>
>>> Change the order with which you store the plots in the array that is
>>> called in gsn_panel.
>>>
>>> phases = new(8,graphic)
>>> phases(0) = phase1plot
>>> phases(1) = phase5plot
>>> phases(2) = phase2plot
>>> phases(3) = phase6plot
>>> ...and so on for all 8.
>>>
>>> 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.
>>>
>>>
>>> Kyle
>>>
>>>
>>> ----------------------------------------
>>> Kyle S. Griffin
>>> Department of Atmospheric and Oceanic Sciences
>>> University of Wisconsin - Madison
>>> Room 1421
>>> 1225 W Dayton St, Madison, WI 53706
>>> Email: ksgriffin2 at wisc.edu
>>>
>>>
>>> On Wed, Aug 6, 2014 at 11:56 AM, WU, Cheuk Kuen <hkson at connect.hku.hk>
>>> wrote:
>>>
>>>> Hi,
>>>>
>>>> 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:
>>>>
>>>> Phase1 Phase2
>>>> Phase3 Phase4
>>>> Phase5 Phase6
>>>> Phase7 Phase8
>>>>
>>>> I want to plot them from top to bottom, left to right, like:
>>>> Phase1 Phase5
>>>> Phase2 Phase6
>>>> Phase3 Phase7
>>>> Phase4 Phase8
>>>>
>>>> However, I cannot find useful information on the Internet. The most
>>>> relevant one is
>>>> http://www.ncl.ucar.edu/Applications/Scripts/panel_12.ncl 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?
>>>>
>>>> Regards,
>>>> John
>>>>
>>>> _______________________________________________
>>>> ncl-talk mailing list
>>>> List instructions, subscriber options, unsubscribe:
>>>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>>>
>>>>
>>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20140807/df56cb72/attachment.html 


More information about the ncl-talk mailing list