[ncl-talk] Panelplot: reduce white space between panels

Rashed Mahmood rashidcomsis at gmail.com
Mon Apr 30 14:03:31 MDT 2018


Hi Tabish,
By default panelling is done using the size of the first plot. Since your
first plot has legend on top of the plot (I checked with dummy data) while
others do not, and therefore the size of your first plot is larger than the
rest. So in your case you can do several things, 2 methods:

1) Move the legend inside the first plot by playing with the resource
"res at pmLegendOrthogonalPosF = -0.4", you may need several iterations to
adjust.

OR

2) In panel resource list add this "resP at gsnPanelScalePlotIndex      = 1" ;
1 means second plot since it counts from 0.  This would force panel
according to  the size of second plot.


In general, I would also turn off or remove the res at gsnMaximize.

Other possible solutions include using viewport  resources.
Cheers,
Rashed







On Mon, Apr 30, 2018 at 12:25 PM, Tabish Ansari <tabishumaransari at gmail.com>
wrote:

> Hi Rashed
>
> Thanks very much for your email. I just tried that. Now there's no warning
> but still there's a lot of white space between the panels even after setting
> resP@*gsnPanelYWhiteSpacePercent* = 0.0
>
> Let me know if there's any solution to this.
>
>
> Thanks
>
> Tabish
>
> Tabish U Ansari
> PhD student, Lancaster Environment Center
> Lancaster Univeristy
> Bailrigg, Lancaster,
> LA1 4YW, United Kingdom
>
> On 30 April 2018 at 06:57, Rashed Mahmood <rashidcomsis at gmail.com> wrote:
>
>> sorry forgot to add NCL-talk.
>>
>> ---------- Forwarded message ----------
>> From: Rashed Mahmood <rashidcomsis at gmail.com>
>> Date: Sun, Apr 29, 2018 at 10:56 PM
>> Subject: Re: [ncl-talk] Panelplot: reduce white space between panels
>> To: Tabish Ansari <tabishumaransari at gmail.com>
>>
>>
>> Hi Tabish,
>> I think *"gsnPanelYWhiteSpacePercent" *is a panel resource and should be
>> added in your panel resource list (i.e. resP), try the following:
>> resP@*gsnPanelYWhiteSpacePercent* = 2
>>
>> There are other possible ways of reducing space between the plots, for
>> example, using view point resources:
>> https://www.ncl.ucar.edu/Document/Graphics/Resources/vp.shtml
>>
>> Cheers,
>> Rashed
>>
>>
>>
>> On Sun, Apr 29, 2018 at 5:05 PM, Tabish Ansari <
>> tabishumaransari at gmail.com> wrote:
>>
>>> Hi
>>>
>>> I have 4 time series plots that I want to panel in 4 rows with minimal
>>> white space in between them - I do not want to attach the plots to a common
>>> axis however.
>>>
>>> I'm unable to achieve this using the "gsnPanelYWhiteSpacePercent"
>>> resource.
>>> On using this resource I get the following warning:
>>>
>>> *warning:gsnPanelYWhiteSpacePercent is not a valid resource in
>>> IAP260m-ts_xy at this time*
>>>
>>> Here's the relevant part of my script:
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> *;---Start the graphicswks = gsn_open_wks("x11","IAP260m-ts") ; send
>>> graphics to PNG file;---Plotting options for time series
>>> plotres             = Trueres at gsnMaximize = True;res at gsnPaperOrientation =
>>> "landscape";res at vpKeepAspect=Falseres at tiMainString     = "Pollutants at
>>> 260m at IAP site"          ; add titleres at vpWidthF    = 2res at vpHeightF   =
>>> 0.4res at xyMarkLineMode = "Lines"res at xyMarkers      =
>>> (/0,0,0,0/)res at tmXTOn      = Falseres at tmYLFormat  = "f"      ; remove
>>> trailing ".0"res at xyDashPatterns  = (/0,0,0,0/)                         ;
>>> Make curves all solidres at xyLineThicknesses = (/  1.0, 1.0, 1.0,
>>> 1.0/)          ; make second line thickerres at xyLineColors      =
>>> (/"blue","black", "black", "red"/)          ; change line
>>> color;--------------------------------------------------; The
>>> time_axis_label function adds additional; resources to "res" to produce
>>> nicely-formatted; time labels on X axis. This function only works; if you
>>> have a time "units" recognized by the; cd_calendar
>>> function.;--------------------------------------------------
>>> restick           = True; restick at ttmFormat = "%D_%H"  restick at ttmFormat =
>>> "%D";   restick at ttmNumTicks = 20  restick at ttmMajorStride= 48
>>> restick at ttmMinorStride= 24 timearr = ispan (1,696,1) timearr at units = "hours
>>> since 2014-10-15
>>> 00:00:00" time_axis_labels(timearr,res,restick)res at trXMaxF=max(timearr);res at tiMainString
>>> = filename;  res at tiYAxisString      = "PM 2.5 in ug/m^3"
>>> res at tiMainFontHeightF  = 0.05  res at tiYAxisFontHeightF = 0.05
>>> res at tmXBLabelFontHeightF = 0.05;  res at tmYLLabelFontHeightF = 0.05
>>> res at tmYUseLeft           = False   ; Make right axis independent of left
>>> res at tmYLOn               = False   ; Turn off left tickmarks
>>> res at tmYROn               = True    ; Turn on right tickmarks
>>> res at tmXTOn               = False   ; Turn off top tickmarks
>>> res at tmYLLabelsOn         = False   ; Turn off left labels
>>> res at tmYRLabelsOn         = True    ; Turn on right labels
>>> res at tmYRMinorOn          = False   ; Turn off minor ticks on Y axis
>>> res at tmYRLabelFontHeightF = 0.04   ; Increase font height
>>> res at tmYRLabelDeltaF      = 2.0     ; Increase space b/w ticks and labels
>>> res at tmYRLabelJust        = "CenterRight"   ; right-justify labels
>>> ;res at tmXBMajorOutwardLengthF = 0.0               ; draw tickmarks inward
>>> ;res at tmXBMinorOutwardLengthF = 0.0               ; draw minor ticks inward
>>> ;res at gsnPanelYWhiteSpacePercent = 0.0  res at gsnBoxMargin = 0.0
>>> res at pmLegendDisplayMode    = "Always"            ; turn on legend
>>> res at pmLegendSide           = "Top"               ; Change location of
>>> res at pmLegendParallelPosF   = .90                  ; move units right
>>> res at pmLegendOrthogonalPosF = 0               ; move units down
>>> res at pmLegendWidthF         = 0.3                ; Change width and
>>> res at pmLegendHeightF        = 0.3                ; height of legend.
>>> res at lgPerimOn              = False               ; turn off box around
>>> res at lgLabelFontHeightF     = .03                 ; label font height
>>> res at xyExplicitLegendLabels =
>>> (/"baseline","APEC-control","Oct-control","obs"/)         ; create explicit
>>> labels  res at gsnDraw  = False                          ; don't draw
>>> res at gsnFrame = False                          ; don't advance frame; Change
>>> y axis string and color for each plot.  res at tiYAxisString = "OC"  xy1 =
>>> gsn_csm_xy(wks,timearr,var_matrix_oc,res)    ; Create the four plots.
>>> res at pmLegendDisplayMode    = "Never"            ; turn off legend for
>>> subsequent plots  res at tiYAxisString = "NO3"  xy2 =
>>> gsn_csm_xy(wks,timearr,var_matrix_no3,res)  res at tiYAxisString = "SO4"  xy3
>>> = gsn_csm_xy(wks,timearr,var_matrix_so4,res)  res at tiYAxisString = "NH4"
>>> xy4 =
>>> gsn_csm_xy(wks,timearr,var_matrix_nh4,res);************************************************;
>>> create panel;************************************************
>>> resP                    = True                 ; modify the panel plot
>>> resP at gsnPanelMainString = "Surface pollutants at IAP site"     ; set main
>>> title  gsn_panel(wks,(/xy1,xy2,xy3,xy4/),(/4,1/),resP)               ; now
>>> draw as one plot*
>>>
>>>
>>> Please let me know what can I change here to get the desired result.
>>>
>>> Thanks
>>>
>>> Tabish
>>>
>>>
>>> Tabish U Ansari
>>> PhD student, Lancaster Environment Center
>>> Lancaster Univeristy
>>> Bailrigg, Lancaster,
>>> LA1 4YW, United Kingdom
>>>
>>> _______________________________________________
>>> 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/20180430/154f001a/attachment.html>


More information about the ncl-talk mailing list