[ncl-talk] panel_33.ncl

Laura Fowler laura at ucar.edu
Tue Nov 20 12:26:24 MST 2018


Hi Mary:
Thanks. This is indeed very confusing to me. For instance, in
panel_33_mod.ncl, if I comment out the lines (see lines below) but keep
panelid1 and maximize_output, then I get the following png file (see
attached). I thought it was just going to plot the top six figures but it
added an other figure at the bottom.

So I am not sure what the combination of gsn_panel_return with
maximize_output does. And I did not find documentation on the 2 functions.

Cheers,
Laura


;    bb     = NhlGetBB(plots(nyears_cols:))

;    bottom = min(bb(:,1))

;    top    = max(bb(:,0))

;    height = (top-bottom)

;    print("--- bottom = "+bottom)

;    print("--- top    = "+top)

;    print("--- height = "+height)




;---Panel the difference plots at the bottom

;    delete(pres at gsnPanelMainString)

;    pres at gsnPanelTop       := bottom - 0.01   ; the 0.01 gives a little
spaces b/w the two sets of plots

;    pres at gsnPanelBottom    := pres at gsnPanelTop - height

;    pres at lbBoxEndCapStyle  = "TriangleBothEnds"

;    pres at pmLabelBarHeightF = (pres at gsnPanelTop - pres at gsnPanelBottom) * 0.8


;    panelid2 =
gsn_panel_return(wks,diff_plots,(/nyears_rows-1,nyears_cols/),pres)


;    drawNDCGrid(wks)

;    draw(wks)

;    frame(wks)

On Tue, Nov 20, 2018 at 10:29 AM Mary Haley <haley at ucar.edu> wrote:

> Hi Laura,
>
> This is an excellent question.
>
> It is a bit of black magic trying to get the plots to panel correctly.
> gsn_panel could really stand an overhaul to make it work better in this
> regard.
>
> Part of the issue is that gsn_panel always wants to expand the plots to
> fit in the given area. This does not include the title or the side
> labelbars, just the plots.
>
> The "given area" is what's defined by gsnPanelBottom, gsnPanelTop,
> gsnPanelLeft, and gsnPanelRight, which by default form a square with values
> 0, 1, 0, and 1.
>
> If you are plotting a set of 3x4 plots and another set of 1x3 plots, then
> you need to set up the two panel areas for the two sets of plots to have
> the correct ratio as the plots you have. For example, for a 3x4 plot and a
> 1x4 plot, you want to have 3x as much height for the 3x4 plot as the 1x4
> plot.  If you had a 2x5 and 3x5 set of plots, then the 2x5 plots need to
> take up 2/5 of the total height, and the 3x5 plots 3/5 of the height.
>
> It gets more complicated because when you add in a title or a labelbar,
> then you need to leave space for those.
>
> I will try to come up with an example for you today. This is something
> I've been meaning to do.
>
> --Mary
>
> On Tue, Nov 20, 2018 at 6:46 AM Laura Fowler <laura at ucar.edu> wrote:
>
>> Hi Mary:
>>
>> Many thanks for taking the time to rework the script. Using
>> panel_33_mod.ncl, I was able to modify my script to produce the plot I
>> needed (see attached totPREC.png and test.ncl in
>> /gpfs/fs1/scratch/laura/MPASprojects2018/MPAS.cu_shallow/novemberPUBLICATION/precipitation_figs).
>> I need a little more work to align DEC 2015 and JUN 2016 to their
>> respective columns).
>>
>> I further modified test.ncl (test2.ncl in the same directory) to remove
>> one row from the top panel so that I can have 2 panels of two rows with one
>> color bar for each panel. I do not understand the logic on how to modify
>> res at gsnPanelBottom to make this work on a more systematic basic. It
>> seems like there is a lot of "guessing" in doing this?
>>
>> Thanks,
>> Laura
>>
>>
>> On Sat, Nov 17, 2018 at 1:59 PM Mary Haley <haley at ucar.edu> wrote:
>>
>>> Hi Laura,
>>>
>>> Try this script. I cleaned up the logic of the panelling to base the
>>> size of the difference plots on the area used for the top set of plots.
>>>
>>> I included a subset of the data file so you can run the modified script.
>>>
>>> I'll include this on the panel page later. I'll also clean up the
>>> panel_33.ncl to be more user friendly to modify.
>>>
>>> --Mary
>>>
>>>
>>> On Sat, Nov 17, 2018 at 4:29 AM Rashed Mahmood <rashidcomsis at gmail.com>
>>> wrote:
>>>
>>>> I think the first issue is related to setting the bottom limit for the
>>>> first set of plots:
>>>>
>>>>     resP at gsnPanelBottom    = 0.33              ; or something similar
>>>>
>>>> The second issue is likely related to maximize_output(wks,True) that would try to use maximum available space. May be you can try commenting this.
>>>>
>>>> Cheers,
>>>>
>>>> Rashed
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> On Fri, Nov 16, 2018 at 1:16 PM Laura Fowler <laura at ucar.edu> wrote:
>>>>
>>>>> Hello:
>>>>>
>>>>> I am trying to produce a panel plot that looks like panel_33.ncl but
>>>>> instead of having 2 rows for the actual fields, I have 3 rows, and instead
>>>>> of having 1 row for the difference fields, I have 2 rows. I have two
>>>>> issues: The first issue is that I am running out of room on the page to
>>>>> plot the last 2 rows and I do not know what to do next? The second issue
>>>>> that the top 3 rows are plotted in a landscape mode although I set:
>>>>>
>>>>> resP at gsnPaperOrientation = "portrait"
>>>>>
>>>>>
>>>>>
>>>>> Here is the script that I used after I created my 10 individual plots:
>>>>>
>>>>>
>>>>> ;--- create panel plot:
>>>>>
>>>>> resP = True
>>>>>
>>>>> resP at gsnDraw             = False
>>>>>
>>>>> resP at gsnFrame            = False
>>>>>
>>>>> resP at gsnPanelLabelBar    = True
>>>>>
>>>>> resP at gsnPaperOrientation = "portrait"
>>>>>
>>>>>
>>>>> resP at lbOrientation      = "vertical"
>>>>>
>>>>> resP at lbLabelFontHeightF = 0.01
>>>>>
>>>>> ;resP at pmLabelBarWidthF  = 0.075
>>>>>
>>>>> ;resP at pmLabelBarHeightF = 0.40
>>>>>
>>>>>
>>>>>
>>>>> panelid1 = gsn_panel_return(wks,plots(0:5),(/3,2/),resP)
>>>>>
>>>>> bb = NhlGetBB(panelid1)
>>>>>
>>>>> top    = max(bb(:,0))
>>>>>
>>>>> bottom = min(bb(:,1))
>>>>>
>>>>> height = (top-bottom)/3.
>>>>>
>>>>> print("--- top    = "+top)
>>>>>
>>>>> print("--- bottom = "+bottom)
>>>>>
>>>>> print("--- height = "+height)
>>>>>
>>>>> print(" ")
>>>>>
>>>>>
>>>>> ;resP at gsnPanelTop   = bottom-0.01    ; lower 1/3 plus some white space
>>>>>
>>>>> resP at gsnPanelTop    = bottom
>>>>>
>>>>> resP at gsnPanelBottom = resP at gsnPanelTop - height
>>>>>
>>>>> print("--- gsnPanelTop = "+resP at gsnPanelTop)
>>>>>
>>>>> print("--- gsnPanelBot = "+resP at gsnPanelBottom)
>>>>>
>>>>>
>>>>> ;panelid2 = gsn_panel_return(wks,plots(6:9),(/2,2/),resP)
>>>>>
>>>>> maximize_output(wks,True)
>>>>>
>>>>>
>>>>> ;resP at gsnDraw             = True
>>>>>
>>>>> ;resP at gsnFrame            = False
>>>>>
>>>>> ;gsn_panel(wks,plots(0:5),(/3,2/),resP)
>>>>>
>>>>> ;frame(wks)
>>>>>
>>>>>
>>>>>
>>>>> When print gsnPanelTop and gsnPanelBottom, I get:
>>>>>
>>>>>
>>>>> (0) --- end create individual plot:
>>>>>
>>>>> (0)
>>>>>
>>>>> (0) --- top    = 0.889811
>>>>>
>>>>> (0) --- bottom = 0.110189
>>>>>
>>>>> (0) --- height = 0.259874
>>>>>
>>>>> (0)
>>>>>
>>>>> (0) --- gsnPanelTop = 0.110189
>>>>>
>>>>> (0) --- gsnPanelBot = -0.149686
>>>>>
>>>>>
>>>>>
>>>>> I am lost as what to do next. Help and suggestions would be greatly
>>>>> appreciated.
>>>>>
>>>>>
>>>>>
>>>>> 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
>>>>>
>>>> _______________________________________________
>>>> 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
>>
>>
>> !-------------------------------------------------------------------------------------------------------------
>>
>

-- 
!-------------------------------------------------------------------------------------------------------------
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/20181120/a00c8f91/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: panel.png
Type: image/png
Size: 176220 bytes
Desc: not available
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20181120/a00c8f91/attachment.png>


More information about the ncl-talk mailing list