[ncl-talk] panel plot, each with their own colormap

Rashed Mahmood rashidcomsis at gmail.com
Tue Aug 7 10:59:28 MDT 2018


Hi Laura,
I think the problem lies with this line:
 pplots = gsn_panel_return(wks,plots(0:1),(/1,2/),resP)

Changing the above line with the following should solve your problem:
 pplots = gsn_panel_return(wks,plots(1:2),(/1,2/),resP)


hope that helps!

Cheers,
Rashed





On Mon, Aug 6, 2018 at 12:17 PM, Laura Fowler <laura at ucar.edu> wrote:

> Hi Rich:
>
> Thanks for your suggestion. I did think of using gsnPanelRowSpec, but
> this won't work since I am using the same color bar for the first and
> second row but a different color bar for the third row instead of one color
> bar for all the rows.That is the reason I decided to follow what is done in
> panel_26.ncl.
>
> It looks like there is some kind of resizing in the second call to
> gsn_panel but I have no idea how this happens either. Not sure what to to
> try next.
>
> Thanks,
> Laura
>
>
>
>
> On Mon, Aug 6, 2018 at 10:37 AM, Rick Brownrigg <brownrig at ucar.edu> wrote:
>
>> Hi Laura,
>>
>> I don't have an answer for why the one plot is so much larger than the
>> others.
>>
>> I wonder however, if you might be able to use the following resource to
>> specify a layout of (/1, 2, 2/), and let gsn_panel() do the spacing:
>>
>> *gsnPanelRowSpec* By default, the *gsn_panel*
>> <http://ncl.ucar.edu/Document/Graphics/Interfaces/gsn_panel.shtml>
>> routine panels its plots according to the *dims* variable which
>> indicates rows x columns. If you set *gsnPanelRowSpec*
>> <http://ncl.ucar.edu/Document/Graphics/Resources/gsn.shtml#gsnPanelRowSpec>
>> to True, however, then you can use the *dims* variable to indicate the
>> number of plots you want per row. For example, setting *gsnPanelRowSpec*
>> <http://ncl.ucar.edu/Document/Graphics/Resources/gsn.shtml#gsnPanelRowSpec>
>> to True and *dims* to (/2,3,1/) will put 2 plots in the first row, 3
>> plots in the second row, and 1 plot in the third row.
>>
>> Default: False
>> I don't knwo for certain whether this will work, but might be worth a
>> shot.
>>
>> Rick
>>
>>
>> On Fri, Aug 3, 2018 at 2:36 PM, Laura Fowler <laura at ucar.edu> wrote:
>>
>>> Hello:
>>>
>>> I followed panel_26.ncl to create 3 panels plots below each other, each
>>> set with their own colormap (see attached file totPREC.dec2015.png). Now, I
>>> would like to do the same thing, but with only one TMPA map centered at the
>>> top of the figure (see tentative figure test.png).
>>>
>>>
>>> For both the 6 and 5 panel plots, I used:
>>>
>>> resP                  = True
>>>
>>> resP at gsnMaximize      = True
>>>
>>> resP at gsnDraw          = False
>>>
>>> resP at gsnFrame         = False
>>>
>>> resP at gsnPanelLabelBar = True
>>>
>>>
>>> pplots = gsn_panel_return(wks,plots(0:1),(/1,2/),resP)
>>>
>>> bb     = NhlGetBB(pplots)
>>>
>>> height = max(bb(0:1,0)) - min(bb(0:1,1))
>>>
>>> print("--- bb(0)  = "+bb(0:1,0))
>>>
>>> print("--- bb(1)  = "+bb(0:1,1))
>>>
>>> print("--- height = "+height)
>>>
>>>
>>> ;--- using height value, now we can panel all sets of plots:
>>>
>>> resP at gsnDraw        = True
>>>
>>> resP at gsnMaximize    = True
>>>
>>> resP at gsnPanelTop    = 1.0
>>>
>>> resP at gsnPanelBottom = resP at gsnPanelTop - height
>>>
>>>
>>> For the 6 panel plot, I used the loop:
>>>
>>> do n = 0,nplots-1,2
>>>
>>>    gsn_panel(wks,plots(n:n+1),(/1,2/),resP)
>>>
>>>
>>> ;---Set for the next panel call.
>>>
>>>    resP at gsnPanelMainString = ""
>>>
>>>    resP at gsnPanelTop        = resP at gsnPanelBottom - 0.02
>>>
>>>    resP at gsnPanelBottom     = resP at gsnPanelTop-height
>>>
>>> end do
>>>
>>> frame(wks)
>>>
>>>
>>> wheres for the 5 panel plot, I used the loop:
>>>
>>> do n = 0,nplots-1,2
>>>
>>>    print("--- n = "+n)
>>>
>>>    if(n .eq. 0) then
>>>
>>>       gsn_panel(wks,plots(0:0),(/1,1/),resP)
>>>
>>>    else
>>>
>>>       gsn_panel(wks,plots(n-1:n),(/1,2/),resP)
>>>
>>>    end if
>>>
>>>    resP at gsnPanelMainString = ""
>>>
>>>    resP at gsnPanelTop        = resP at gsnPanelBottom - 0.02
>>>
>>>    resP at gsnPanelBottom     = resP at gsnPanelTop-height
>>>
>>> end do
>>>
>>> frame(wks)
>>>
>>>
>>> I do not understand why the second plot of the second column is so much
>>> bigger than the one on the left side and the two plots for the third row?
>>> Can somebody help me figure this out?
>>>
>>>
>>> Many thanks,
>>> Laura
>>>
>>>
>>> --
>>> !-----------------------------------------------------------
>>> --------------------------------------------------
>>> Laura D. Fowler
>>>
>>> Mesoscale and Microscale Meteorology Division (MMM)
>>> National Center for Atmospheric Research
>>> P.O. Box 3000, Boulder CO 80307-3000
>>>
>>> e-mail: laura at ucar.edu
>>> phone: 303-497-1628
>>>
>>> !-----------------------------------------------------------
>>> --------------------------------------------------
>>>
>>> _______________________________________________
>>> ncl-talk mailing list
>>> ncl-talk at ucar.edu
>>> List instructions, subscriber options, unsubscribe:
>>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>>
>>>
>>
>
>
> --
> !-----------------------------------------------------------
> --------------------------------------------------
> Laura D. Fowler
>
> Mesoscale and Microscale Meteorology Division (MMM)
> National Center for Atmospheric Research
> P.O. Box 3000, Boulder CO 80307-3000
>
> e-mail: laura at ucar.edu
> phone: 303-497-1628
>
> !-----------------------------------------------------------
> --------------------------------------------------
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> 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/20180807/a3e88c32/attachment.html>


More information about the ncl-talk mailing list