Re: Problem with spacing between plots in a panel plot

From: Adam Phillips <asphilli_at_nyahnyahspammersnyahnyah>
Date: Tue Jul 10 2012 - 14:25:26 MDT

Hi Soumik,
I am not sure what your vp* resources in your panel resource lists
(dresPanel) are actually doing. I would comment those out to make sure
they are not conflicting w/the labelbar placement. That's my first
suggestion. If that doesn't work, do not draw the labelbar via gsn_panel
for the last 2 plots, and turn on the labelbar for this plot:
  plot1_eke2 = gsn_csm_contour_map(wks,eke_diff1,dbres)
setting the labelbar to vertical.. The reason I am suggesting this is
that gsn_panel determines the space to allocate for each panel plot
based on the first paneled plot (by default). Adding a labelbar to the
2nd plot should not change anything position wise.

If none of that works let ncl-talk know.
Adam

On 07/10/2012 02:13 PM, Soumik Basu wrote:
> Hi Adam,
>
> Thanks for the help. I fixed the size of the maps with the help of the
> example you send me last time but I am still having trouble with the
> colorbar for the second set of panel. Can you please suggest me how to
> fix it. I am attaching the plot and the script.
> Here is the output from "@gsnDebugPanel" resource:
>
> (0) min=-31.4859 max=36.0107
> (0) There are 4 valid plots out of 4 total plots
> (0) -------Panel viewport values for each plot-------
> (0) plot #0
> (0) new x,y = 0.0337983,0.724568
> (0) orig wdt,hgt = 0.4,0.2
> (0) new wdt,hgt = 0.403826,0.201913
> (0) -------Panel viewport values for each plot-------
> (0) plot #1
> (0) new x,y = 0.485126,0.724568
> (0) orig wdt,hgt = 0.4,0.2
> (0) new wdt,hgt = 0.403826,0.201913
> (0) -------Panel viewport values for each plot-------
> (0) plot #2
> (0) new x,y = 0.0337983,0.497777
> (0) orig wdt,hgt = 0.4,0.2
> (0) new wdt,hgt = 0.403826,0.201913
> (0) -------Panel viewport values for each plot-------
> (0) plot #3
> (0) new x,y = 0.485126,0.497777
> (0) orig wdt,hgt = 0.4,0.2
> (0) new wdt,hgt = 0.403826,0.201913
> (0) -------min/max X,Y viewport positions for plots-------
> (0) min/max x viewport position = 0.0337983/0.485126
> (0) min/max y viewport position = 0.497777/0.724568
> (0) -------min/max NDC values for all objects in panel-------
> (0) min/max x position = 0.00442476/0.995575
> (0) min/max y position = 0.275432/0.724568
> (0) There are 2 valid plots out of 2 total plots
> (0) -------Panel viewport values for each plot-------
> (0) plot #0
> (0) new x,y = 0.0337983,0.261172
> (0) orig wdt,hgt = 0.4,0.2
> (0) new wdt,hgt = 0.403826,0.201913
> (0) -------Panel viewport values for each plot-------
> (0) plot #1
> (0) new x,y = 0.485126,0.261172
> (0) orig wdt,hgt = 0.4,0.2
> (0) new wdt,hgt = 0.403826,0.201913
> (0) -------min/max X,Y viewport positions for plots-------
> (0) min/max x viewport position = 0.0337983/0.485126
> (0) min/max y viewport position = 0.261172/0.261172
> (0) gsnPanelInvsblRight = 0.89823
> (0) -------min/max NDC values for all objects in panel-------
> (0) min/max x position = 0.00442476/0.89823
> (0) min/max y position = 0.0388277/0.450943
>
> Thanks,
> Soumik
>
> On 2012-07-06 20:09, Adam Phillips wrote:
>> Hi Soumik,
>> Do the same thing for your dres and dres resource lists. Also, since
>> you are panel plotting two different sets of panel plots, you probably
>> should go ahead and turn off gsnMaximize for your panel resource lists
>> too. If you do that, then you can try using maximize_output, shown
>> being used here:
>> http://www.ncl.ucar.edu/Applications/Scripts/panel_20.ncl
>> Adam
>>
>>
>> On Jul 6, 2012, at 6:53 PM, Soumik Basu <sbasu@iarc.uaf.edu> wrote:
>>
>>> Hi Adam,
>>>
>>> Thanks for the reply. I removed it but I am still having the same
>>> problem.
>>>
>>> Thanks,
>>> Soumik
>>>
>>> On 2012-07-06 16:41, Adam Phillips wrote:
>>>> Hi Soumik,
>>>> When you are paneling plots, it is recommended that you do not set
>>>> gsnMaximize = True in your individual plot resource lists. (res and
>>>> sres in your case) It is of course fine to set gsnMaximize in the
>>>> panel resource list. Try removing gsnMaximize from your res and sres
>>>> resource lists and see if that helps... Adam
>>>>
>>>>
>>>>
>>>> On Jul 6, 2012, at 3:58 PM, Soumik Basu <sbasu@iarc.uaf.edu> wrote:
>>>>
>>>>> Hi Adam,
>>>>>
>>>>> Thanks for the reply.I made those changes but I am still getting
>>>>> the similar plots. Can you please suggest what else can cause it.
>>>>> here is the complete plotting resources:
>>>>>
>>>>>
>>>>> ;*******************************************************
>>>>> ;Plot resources for eady growth first set (non shaded)
>>>>> ;******************************************************
>>>>>
>>>>> wks =
>>>>> gsn_open_wks("png","eady_eke_var_diff_spring_winter")
>>>>> gsn_define_colormap(wks,"BlAqGrYeOrReVi200")
>>>>>
>>>>>
>>>>> res = True
>>>>> res@cnLinesOn = True
>>>>>
>>>>> res@tmLabelAutoStride = True
>>>>>
>>>>> res@tmXTOn = False
>>>>> res@tmYROn = False
>>>>>
>>>>> res@cnLevelSelectionMode = "ManualLevels"
>>>>> res@cnMinLevelValF = 0
>>>>> res@cnMaxLevelValF = 2.0
>>>>> res@cnLevelSpacingF = 0.2
>>>>> res@cnLineLabelFontHeightF= 0.015
>>>>> res@cnInfoLabelOn = False ; turn off
>>>>> cn info label
>>>>> res@cnLineLabelsOn = False
>>>>>
>>>>> res@lbLabelBarOn = False
>>>>>
>>>>> res@gsnDraw = False
>>>>> res@gsnFrame = False
>>>>> res@gsnMaximize = True
>>>>>
>>>>> res@pmLabelBarDisplayMode = "Never"
>>>>>
>>>>> ;*************************************************
>>>>> ; Plot resources for eke first set (shaded)
>>>>> ;*************************************************
>>>>> plot = new(4,graphic) ; create a plot array
>>>>>
>>>>> sres = True
>>>>>
>>>>> sres@gsnDraw = False
>>>>> sres@gsnFrame = False
>>>>> sres@gsnMaximize = True
>>>>> sres@gsnSpreadColors = True
>>>>>
>>>>> sres@cnFillOn = True
>>>>> sres@cnLinesOn = False
>>>>> sres@cnLevelSelectionMode = "ManualLevels"
>>>>> sres@cnMinLevelValF = 0
>>>>> sres@cnMaxLevelValF = 250
>>>>> sres@cnLevelSpacingF = 5
>>>>> sres@cnInfoLabelOn = False ;
>>>>> turn off cn info label
>>>>> sres@cnLineLabelsOn = False
>>>>>
>>>>> sres@tmLabelAutoStride = True
>>>>> sres@tmXTOn = False
>>>>> sres@tmYROn = False
>>>>>
>>>>> sres@mpLimitMode = "LatLon"
>>>>> sres@mpMinLatF = 10.
>>>>> sres@mpMaxLatF = 80.
>>>>> sres@mpMinLonF = 130.
>>>>> sres@mpMaxLonF = 330.
>>>>> sres@mpGeophysicalLineThicknessF = 1.75
>>>>> sres@mpCenterLonF = 210
>>>>> sres@mpShapeMode = "FreeAspect"
>>>>> sres@lbOrientation = "vertical" ;vertical label bar
>>>>> sres@lbLabelBarOn = False
>>>>> sres@lbLabelAutoStride = True
>>>>>
>>>>>
>>>>> ;*********************************
>>>>> ; Plot first set (four means)
>>>>> ;*********************************
>>>>>
>>>>> plot_eke1 = gsn_csm_contour_map(wks,eke_var(:,:),sres)
>>>>> plot_eady1 = gsn_csm_contour(wks,eady_var(:,:),res)
>>>>> overlay(plot_eke1,plot_eady1)
>>>>> plot(0) = plot_eke1
>>>>>
>>>>> plot_eke2 = gsn_csm_contour_map(wks,eke_var_ens(:,:),sres)
>>>>> plot_eady2 = gsn_csm_contour(wks,eady_var_ens(:,:),res)
>>>>> overlay(plot_eke2,plot_eady2)
>>>>> plot(1) = plot_eke2
>>>>>
>>>>> res@gsnLeftString = " "
>>>>>
>>>>> plot_eke3 = gsn_csm_contour_map(wks,eke_var1(:,:),sres)
>>>>> plot_eady3 = gsn_csm_contour(wks,eady_var1(:,:),res)
>>>>> overlay(plot_eke3,plot_eady3)
>>>>> plot(2) = plot_eke3
>>>>>
>>>>> plot_eke4 = gsn_csm_contour_map(wks,eke_var_ens1(:,:),sres)
>>>>> plot_eady4 = gsn_csm_contour(wks,eady_var_ens1(:,:),res)
>>>>> overlay(plot_eke4,plot_eady4)
>>>>> plot(3) = plot_eke4
>>>>>
>>>>> ;************************************************
>>>>> ; create first set panel plot(four means)
>>>>> ;************************************************
>>>>> resPanel = True
>>>>>
>>>>> resPanel@gsnFrame = False
>>>>>
>>>>> resPanel@gsnSpreadColors = True
>>>>> resPanel@gsnPanelLabelBar = True
>>>>> ; add color bar
>>>>> resPanel@gsnPanelFigureStrings = (/"a","b","c","d"/)
>>>>> resPanel@gsnPanelFigureStringsFontHeightF = 0.02
>>>>> resPanel@gsnPanelFigureStringsPerimOn = True
>>>>> resPanel@gsnPanelDebug = True
>>>>> resPanel@gsnPanelTop = 0.9
>>>>> resPanel@gsnPanelBottom = 0.3 ;move bottom up from 0 to
>>>>> 0.4
>>>>> resPanel@gsnPanelLeft = 0.0
>>>>> resPanel@gsnPanelRight = 0.9
>>>>> resPanel@gsnPanelDebug = True
>>>>>
>>>>> resPanel@lbOrientation = "Vertical"
>>>>> resPanel@lbLabelAutoStride = False
>>>>> resPanel@lbLabelStride = 5
>>>>>
>>>>> gsn_panel(wks,plot,(/2,2/),resPanel)
>>>>>
>>>>> ;*****************************************************************
>>>>> ; create plot resources eady growth diff next set of plots(non
>>>>> shaded)
>>>>> ;*****************************************************************
>>>>> plot1 = new(2,graphic) ; create a plot array
>>>>>
>>>>> dres = True
>>>>>
>>>>> dres@gsnMaximize = True
>>>>>
>>>>>
>>>>> dres@cnLinesOn = True
>>>>> dres@cnLevelSelectionMode = "ManualLevels"
>>>>> dres@cnMinLevelValF = 0
>>>>> dres@cnMaxLevelValF = 3
>>>>> dres@cnLevelSpacingF = 0.2
>>>>> dres@cnInfoLabelOn = False
>>>>> dres@cnLineLabelsOn = False
>>>>> dres@cnLineLabelDensityF = 1.
>>>>> dres@cnLineLabelFontHeightF = 0.015
>>>>> dres@cnLineLabelInterval = 3
>>>>>
>>>>> dres@tmLabelAutoStride = True
>>>>> dres@tmXTOn = False
>>>>> dres@tmYROn = False
>>>>>
>>>>> dres@lbLabelBarOn = False
>>>>>
>>>>> dres@gsnDraw = False
>>>>> dres@gsnFrame = False
>>>>> dres@gsnMaximize = True
>>>>>
>>>>>
>>>>> ;*****************************************************
>>>>> ; create plot resources eke next set of plots(shaded)
>>>>> ;******************************************************
>>>>>
>>>>> dbres = True
>>>>>
>>>>> dbres@gsnMaximize = True
>>>>> dbres@gsnSpreadColors = True
>>>>> dbres@gsnDraw = False
>>>>> dbres@gsnFrame = False
>>>>>
>>>>> dbres@cnFillOn = True
>>>>> dbres@cnLinesOn = False
>>>>> dbres@cnLevelSelectionMode = "ManualLevels"
>>>>> dbres@cnMinLevelValF = -40
>>>>> dbres@cnMaxLevelValF = 40
>>>>> dbres@cnLevelSpacingF = 0.5
>>>>> dbres@cnInfoLabelOn = False
>>>>> dbres@cnLineLabelsOn = False
>>>>>
>>>>>
>>>>> dbres@tmLabelAutoStride = True
>>>>> dbres@tmXTOn = False
>>>>> dbres@tmYROn = False
>>>>>
>>>>> dbres@lbOrientation = "Vertical"
>>>>> dbres@lbLabelBarOn = False
>>>>> dbres@lbLabelStride = 20.
>>>>> dbres@lbLabelAutoStride = False
>>>>>
>>>>> dbres@mpLimitMode = "LatLon"
>>>>> dbres@mpMinLatF = 10.
>>>>> dbres@mpMaxLatF = 80.
>>>>> dbres@mpMinLonF = 130.
>>>>> dbres@mpMaxLonF = 330.
>>>>> dbres@mpCenterLonF = 210
>>>>> dbres@mpGeophysicalLineThicknessF= 1.75
>>>>>
>>>>> getvalues plot(3)
>>>>> "vpWidthF" : vpw
>>>>> "vpHeightF" : vph
>>>>> end getvalues
>>>>>
>>>>>
>>>>> ; By default, you can't skew the width/height of a map plot.
>>>>> ; You must also set mpShapeMode to "FreeAspect" to indicate
>>>>> ; that you really want to skew the map.
>>>>>
>>>>> dbres@mpShapeMode = "FreeAspect"
>>>>> dbres@vpWidthF = vpw
>>>>> dbres@vpHeightF = vph
>>>>>
>>>>>
>>>>> ; ## SHADED
>>>>>
>>>>> plot1_eke1 = gsn_csm_contour_map(wks,eke_diff,dbres)
>>>>> plot1_eke2 = gsn_csm_contour_map(wks,eke_diff1,dbres)
>>>>>
>>>>> ; ## NON-SHADED
>>>>>
>>>>> plot1_eady1 = gsn_csm_contour(wks,eady_diff,dres)
>>>>> plot1_eady2 = gsn_csm_contour(wks,eady_diff1,dres)
>>>>>
>>>>> overlay(plot1_eke1,plot1_eady1)
>>>>> overlay(plot1_eke2,plot1_eady2)
>>>>>
>>>>> plot1(0) = plot1_eke1
>>>>> plot1(1) = plot1_eke2
>>>>>
>>>>>
>>>>>
>>>>> ;************************************************
>>>>> ; create next set panel plot
>>>>> ;************************************************
>>>>> dresPanel = True
>>>>>
>>>>> dresPanel@gsnFrame = False
>>>>> dresPanel@gsnSpreadColors = True
>>>>> dresPanel@gsnMaximize = True
>>>>> ; use full page
>>>>> dresPanel@gsnPanelLabelBar = True
>>>>> ; add color bar
>>>>> dresPanel@gsnPanelTop = 0.45
>>>>> dresPanel@gsnPanelBottom = 0.1
>>>>> dresPanel@gsnPanelLeft = 0.0
>>>>> dresPanel@gsnPanelRight = 0.9
>>>>> dresPanel@gsnPanelFigureStrings = (/"e","f"/)
>>>>> dresPanel@gsnPanelFigureStringsFontHeightF = 0.02
>>>>> dresPanel@gsnPanelFigureStringsPerimOn = True
>>>>> dresPanel@gsnPanelDebug = True
>>>>>
>>>>> dresPanel@lbOrientation = "Vertical"
>>>>> dresPanel@lbLabelAutoStride = False
>>>>> dresPanel@lbLabelStride = 10
>>>>>
>>>>> gsn_panel (wks,plot1,(/1,2/),dresPanel)
>>>>>
>>>>> frame(wks)
>>>>>
>>>>>
>>>>>
>>>>> Thanks,
>>>>> Soumik
>>>>>
>>>>>
>>>>> On 2012-07-05 19:20, Adam Phillips wrote:
>>>>>> Hi Soumik,
>>>>>> Your top 4 plots are not taking up all of the space you are
>>>>>> allotting
>>>>>> to them. They are maxed out on the page horizontally, and they are
>>>>>> only taking up roughly 0.5-0.9 of vertical NDC space. To take up
>>>>>> more
>>>>>> space, NCL would need to alter the aspect ratio of the plot(s),
>>>>>> something it won't do unless you tell it to. (Setting
>>>>>> res@mpShapeMode=
>>>>>> "FreeAspect" would do that. )
>>>>>>
>>>>>> Try setting gsnPanelTop for your bottom 2 plots to 0.45 (instead
>>>>>> of 0.3)..
>>>>>> Hope that helps.. Adam
>>>>>>
>>>>>>
>>>>>> On Jul 5, 2012, at 6:21 PM, Soumik Basu <sbasu@iarc.uaf.edu> wrote:
>>>>>>
>>>>>>> Hi,
>>>>>>>
>>>>>>> I am trying to create a panel plot containing 6 plots. But I am
>>>>>>> having
>>>>>>> problem with the space between the plots.I am plotting the first
>>>>>>> four
>>>>>>> plots with a particular colorbar and the last two with another
>>>>>>> colorbar.
>>>>>>> Can anybody please suggest me what is going wrong.
>>>>>>>
>>>>>>> The panel plot resources (I am sending only the two separate
>>>>>>> resource
>>>>>>> parts of my script) I am using are as follows:
>>>>>>>
>>>>>>> ;************************************************
>>>>>>> ; create first set panel plot(top four of the panel)
>>>>>>> ;************************************************
>>>>>>> resPanel = True
>>>>>>>
>>>>>>> resPanel@gsnFrame = False
>>>>>>>
>>>>>>> resPanel@gsnSpreadColors = True
>>>>>>> resPanel@gsnPanelLabelBar = True
>>>>>>> ; add
>>>>>>> color bar
>>>>>>> resPanel@gsnPanelFigureStrings = (/"a","b","c","d"/)
>>>>>>> resPanel@gsnPanelFigureStringsFontHeightF = 0.02
>>>>>>> resPanel@gsnPanelFigureStringsPerimOn = True
>>>>>>> resPanel@gsnPanelDebug = True
>>>>>>> resPanel@gsnPanelTop = 0.9
>>>>>>> resPanel@gsnPanelBottom = 0.3 ;move
>>>>>>> bottom up
>>>>>>> from 0 to 0.4
>>>>>>> resPanel@gsnPanelLeft = 0.0
>>>>>>> resPanel@gsnPanelRight = 0.9
>>>>>>> resPanel@gsnPanelDebug = True
>>>>>>>
>>>>>>> resPanel@lbOrientation = "Vertical"
>>>>>>> resPanel@lbLabelAutoStride = False
>>>>>>> resPanel@lbLabelStride = 5
>>>>>>>
>>>>>>> gsn_panel(wks,plot,(/2,2/),resPanel)
>>>>>>>
>>>>>>> ;************************************************
>>>>>>> ; create last 2 of panel plot
>>>>>>> ;************************************************
>>>>>>> dresPanel = True
>>>>>>>
>>>>>>> dresPanel@gsnFrame = False
>>>>>>> dresPanel@gsnSpreadColors = True
>>>>>>> dresPanel@gsnMaximize = True
>>>>>>> ; use full
>>>>>>> page
>>>>>>> dresPanel@gsnPanelLabelBar = True
>>>>>>> ; add
>>>>>>> color bar
>>>>>>> dresPanel@gsnPanelTop = 0.3
>>>>>>> dresPanel@gsnPanelBottom = 0.1
>>>>>>> dresPanel@gsnPanelLeft = 0.0
>>>>>>> dresPanel@gsnPanelRight = 0.9
>>>>>>> dresPanel@gsnPanelFigureStrings = (/"e","f"/)
>>>>>>> dresPanel@gsnPanelFigureStringsFontHeightF = 0.02
>>>>>>> dresPanel@gsnPanelFigureStringsPerimOn = True
>>>>>>> dresPanel@gsnPanelDebug = True
>>>>>>>
>>>>>>> dresPanel@lbOrientation = "Vertical"
>>>>>>> dresPanel@lbLabelAutoStride = False
>>>>>>> dresPanel@lbLabelStride = 10
>>>>>>>
>>>>>>> gsn_panel (wks,plot1,(/1,2/),dresPanel)
>>>>>>> frame(wks)
>>>>>>>
>>>>>>>
>>>>>>> Thanks,
>>>>>>> Soumik
>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>> "Numbing the pain for a while will make it worse when you
>>>>>>> finally feel it.
>>>>>>> ~J.K. Rowling"
>>>>>>> *****************************************
>>>>>>> Soumik Basu
>>>>>>> Graduate Student, Research Assistant
>>>>>>> International Arctic Research Center
>>>>>>> University of Alaska Fairbanks
>>>>>>> Fairbanks,Alaska,USA
>>>>>>> *****************************************
>>>>>>> <eady_eke_var_diff_spring_winter.000001.png>
>>>>>>> _______________________________________________
>>>>>>> ncl-talk mailing list
>>>>>>> List instructions, subscriber options, unsubscribe:
>>>>>>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>>>>
>>>>> --
>>>>> "Numbing the pain for a while will make it worse when you finally
>>>>> feel it.
>>>>> ~J.K. Rowling"
>>>>> *****************************************
>>>>> Soumik Basu
>>>>> Graduate Student, Research Assistant
>>>>> International Arctic Research Center
>>>>> University of Alaska Fairbanks
>>>>> Fairbanks,Alaska,USA
>>>>> *****************************************
>>>>> <eady_eke_var_diff_spring_winter.000001.png>
>>>>> _______________________________________________
>>>>> ncl-talk mailing list
>>>>> List instructions, subscriber options, unsubscribe:
>>>>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>>
>>> --
>>> "Numbing the pain for a while will make it worse when you finally
>>> feel it.
>>> ~J.K. Rowling"
>>> *****************************************
>>> Soumik Basu
>>> Graduate Student, Research Assistant
>>> International Arctic Research Center
>>> University of Alaska Fairbanks
>>> Fairbanks,Alaska,USA
>>> *****************************************
>

-- 
______________________________________________________________
Adam Phillips                                asphilli@ucar.edu
NCAR/Climate and Global Dynamics Division       (303) 497-1726
P.O. Box 3000				
Boulder, CO 80307-3000    http://www.cgd.ucar.edu/cas/asphilli
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Tue Jul 10 14:25:33 2012

This archive was generated by hypermail 2.1.8 : Thu Jul 12 2012 - 10:16:50 MDT