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

Rashed Mahmood rashidcomsis at gmail.com
Tue Aug 7 13:23:34 MDT 2018


Hi Laura,
Could you please share full script or the part that has ALL resources? It
seems that all plots are being created with same contour levels?

Cheers,
Rashed

On Tue, Aug 7, 2018 at 12:15 PM, Laura Fowler <laura at ucar.edu> wrote:

> Hi Rashed:
>
> Many thanks for your suggestion. I really appreciate you taking an
> interest in my very pesky problem! Following your idea helped removed the
> "big" plot in the second row of the panel, but it now shifted the label bar
> for the second row to the third row. If you compare test.png and
> totPREC.dec2015.png, then you will see that the bottom row is the same as
> that for the second row, which is not what I expected (see
> totPREC.dec2015.png where the panels for the top row are the same and not
> centered.)
>
> Great idea though. At this time, I'd tried anything.Thanks.
> Laura
>
>
>
>
>
> On Tue, Aug 7, 2018 at 10:59 AM, Rashed Mahmood <rashidcomsis at gmail.com>
> wrote:
>
>> 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
>>>
>>>
>>
>
>
> --
> !-----------------------------------------------------------
> --------------------------------------------------
> 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
>
> !-----------------------------------------------------------
> --------------------------------------------------
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20180807/78b0c29b/attachment.html>


More information about the ncl-talk mailing list