Re: Minor adjustments to a panel plot

From: Marston Johnston <shejo284_at_nyahnyahspammersnyahnyah>
Date: Tue Aug 27 2013 - 12:35:07 MDT

Hi Adam,

I'm sorry, I made a mistake when responding. I did as you advised. Here's
my code, the plotting part, plus a copy of the fig.

;************************************************

; create plots

;************************************************

  wks = gsn_open_wks("pdf","./output/"+ename(n)) ; open a ps
file

  gsn_define_colormap(wks,"gui_default")

  plot = new((/1*dimsizes(ret&time)/),graphic) ; create a plot array

  res = True

  res@gsnDraw = False ; don't draw

  res@gsnFrame = False ; don't advance frame

  res@cnInfoLabelOn = False ; turn off cn info label

  res@cnFillOn = True ; turn on color

  res@gsnSpreadColors = True ; spread out color table

  res@gsnSpreadColorStart = 2

  res@gsnSpreadColorEnd = -3

  res@lbLabelBarOn = False ; turn off individual cb's

  res@gsnAddCyclic = False ; lons are not 0-360

  res@tmXBLabelsOn = True ; draw bottom labels

  res@tmXBOn = True ; bottom tickmarks

  res@gsnStringFontHeightF = fsize; 0.07

  res@tmYRLabelsOn = False ; no right labels

  res@tmYROn = False ; no right tickmarks

; now change the size of the tickmark labels

  res@tmXBLabelFontHeightF = fsize ;0.07 ; resize tick
labels

  res@tmYLLabelFontHeightF = fsize ;0.07

  ; add the longitude labels

  res@tmXBMode = "Explicit"

  res@tmXBValues = (/-10,0,10/)

  res@tmXBLabels = (/"","",""/);(/"-10~S~o~N~","0","10~S~o~N~"/)

  res@tmYLMode = "Explicit"

  res@tmYLValues = (/-10,0,10/)

  res@tmYLLabels = (/"-10~S~o~N~","0","10~S~o~N~"/)

  res@gsnStringFontHeightF = fsize ; 0.07

  res@gsnCenterStringOrthogonalPosF = fsize ; 0.07

  res@tiYAxisOn = False

  res@cnLevelSelectionMode = "ManualLevels" ; manually set contour
levels

  if(vname(n).eq."uthece" .or. vname(n).eq."uthamsu") then

     res@cnMinLevelValF = 20. ; set the minimum contour
level

     res@cnMaxLevelValF = 100. ; set the maximum contour
level

     res@cnLevelSpacingF = 5.

  end if

  do p = 0, dimsizes(ret&time) - 1

    res@gsnCenterString = flt2string(ret&time(p))+"h"

    if(p.gt.0) then

      res@tmYLLabelsOn = False ; left Y label

      res@tmYLOn = False

    else

      res@tmYLLabelsOn = True

      res@tmYLOn = True

    end if

    plot(p) = gsn_csm_contour(wks,ret(p,:,:),res)

  end do

  resP = True ; modify the panel plot

  resP@gsnFrame = False ; don't advance panel plot

  resP@gsnPanelLabelBar = True ; add common colorbar

  resP@gsnPanelBottom = 0.05

  resP@gsnPaperOrientation = "auto"

  resP@gsnMaximize = True

  resP@gsnPanelXWhiteSpacePercent = 0.0 ; set spacing horizontal
between 2 panels

  resP@lbTitleOn = True ; turn on title

  resP@lbLabelFontHeightF = .005 ; make labels larger

  resP@lbTitleString = lunits(n)

  resP@lbTitleFontHeightF = .009 ; make title smaller

  resP@pmLabelBarOrthogonalPosF = -0.013 ; Move the colorbar lower
down

  gsn_panel(wks,plot,(/1,dimsizes(ret&time)/),resP)

/M

On Tue, Aug 27, 2013 at 5:18 PM, Adam Phillips <asphilli@ucar.edu> wrote:

> Hi Marston,
> To be clear, I advised you to set tiYAxisOn = False (in the plot resource
> list), and not tiXAxisOn.. If you are setting tiYAxisOn = False, and still
> are not seeing the desired results please go ahead and send the script to
> ncl-talk..
> Adam
>
>
> On 08/27/2013 08:32 AM, Marston Johnston wrote:
>
> Hi Adam,
>
> I take it this tiXAxisOn is part of the options for the single plots and
> not the panel itself?
> I tried as you suggested but to no avail.
>
> Would you like to see the code?
>
> /M
>
>
> On Tue, Aug 27, 2013 at 4:00 PM, Adam Phillips <asphilli@ucar.edu> wrote:
>
>> Hi Marston,
>> In panel example 6 gsnPanelXWhiteSpacePercent was set in the resP
>> (=panel) resource list.. Are you saying that you set the same resource to 0
>> in the panel resource list and you are still not getting rid of enough
>> white space? If so, try setting tiYAxisOn= False (tells NCL to not allocate
>> space for the y-axis title) in your plot resource list to see if that frees
>> up any further space.
>>
>> If you still are not getting the desired results let NCL talk know..
>> Adam
>>
>> On Aug 27, 2013, at 1:38, Marston Johnston <shejo284@gmail.com> wrote:
>>
>> Hi Adam,
>>
>> Thanks for the tips. I found the panel plot page but got a bit lost in
>> the many examples. I got all but the white space to work. In the example,
>> the resP variable is set to False, but that is not a good option for me as
>> I would like to do other things with the plots than simply remove the white
>> space. Setting the percentage of whitespace in the x-axis direction to 0
>> didn't give the desired results.
>>
>> /M
>>
>>
>> On Mon, Aug 26, 2013 at 6:20 PM, Adam Phillips <asphilli@ucar.edu> wrote:
>>
>>> Hi Marston,
>>> Whenever I have a question related to paneling I will first take a look
>>> at the paneling examples page located off of the examples page here:
>>> http://www.ncl.ucar.edu/Applications/
>>> ("Panel plots", located along the left side of page 1/2 down.)
>>> Of course not everything is covered with the examples, but I usually
>>> find what I need on that page. The answers for your 1st and 4th questions
>>> can be found on that page.
>>>
>>>
>>> 1.) I would like the colorbar to be lower so that the label on the
>>> X-axis (bottom) to be plotted and seen.
>>> You should set pmLabelbarOrthogonalPosF in your panel resource list.
>>> See example #21 here:
>>> http://www.ncl.ucar.edu/Applications/panel.shtml#ex21
>>>
>>>
>>> 2.) How do I label the longitude (x-axis) similarly to the latitude
>>> (y-axis) label, i.e., (-10W 0 10E)?
>>> You will want to set tmXBMode = "Explicit", and then set tmXBValues
>>> = (/-10,0,10/) and tmXBLabels = (/"10W","0E","10E"/). This example (#2)
>>> modifies the x-axis labels for a timeseries plot, but the usage of the
>>> above resources is the same:
>>> http://www.ncl.ucar.edu/Applications/tickmarks.shtml#ex2
>>> or, see example #6 here:
>>> http://www.ncl.ucar.edu/Applications/mptick.shtml#ex6
>>>
>>>
>>> 3.) How do I increase the spacing between the gsnLeft/Center/RightString
>>> (s) and the top axis?
>>> gsnLeftStringOrthogonalPosF / gsnCenterStringOrthogonalPosF /
>>> gsnRightStringOrthogonalPosF
>>> To see an example of their use, see example 3 here:
>>> http://www.ncl.ucar.edu/Applications/raster.shtml#ex3
>>>
>>>
>>> 4.) How do I reduce the whitespace between the plots?
>>> gsnPanelXWhiteSpacePercent
>>> See example #6 here:
>>> http://www.ncl.ucar.edu/Applications/panel.shtml#ex6
>>>
>>> Hope that helps!
>>> Adam
>>>
>>>
>>> On 08/26/2013 09:59 AM, Marston Johnston wrote:
>>>
>>> Hi,
>>>
>>> I'm trying to make a few minor adjustments to the attached panel plot,
>>> but to no avail. I'm not sure where to look.
>>>
>>> 1.) I would like the colorbar to be lower so that the label on the
>>> X-axis (bottom) to be plotted and seen.
>>> 2.) How do I label the longitude (x-axis) similarly to the latitude
>>> (y-axis) label, i.e., (-10W 0 10E)?
>>> 3.) How do I increase the spacing between the gsnLeft/Center/RightString
>>> (s) and the top axis?
>>> 4.) How do I reduce the whitespace between the plots?
>>>
>>> I've included the code and the plot I currently have.
>>>
>>> Thanks for your help,
>>> /M
>>>
>>>
>>>
>>>
>>> _______________________________________________
>>> ncl-talk mailing list
>>> List instructions, subscriber options, unsubscribe:http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>>
>>>
>>> --
>>> ______________________________________________________________
>>> 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
>>>
>>>
>>
>>
>> --
>> Only the fruitful thing is true!
>>
>> _______________________________________________
>> ncl-talk mailing list
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>
>>
>
>
> --
> Only the fruitful thing is true!
>
>
> --
> ______________________________________________________________
> 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
>
>

-- 
Only the fruitful thing is true!


_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk

Received on Tue Aug 27 12:35:34 2013

This archive was generated by hypermail 2.1.8 : Fri Aug 30 2013 - 14:04:57 MDT