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

Tabish Ansari tabishumaransari at gmail.com
Sun Apr 29 18:05:29 MDT 2018


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20180430/e6764869/attachment.html>


More information about the ncl-talk mailing list