Re: Problems with plot labeling

From: Helen Parish <hparish_at_nyahnyahspammersnyahnyah>
Date: Wed, 17 Jun 2009 06:00:35 -0700

Mary,

Adding the line you suggested, "res_at_pmTitleZone = 2" , did produce
changes in both the x-axis and y-axis labels. Both labels were moved
closer to the plot, so that they both now overlap the axis numbers.
The x-axis label is now above the label bar, but the result is not
good, and now the y-axis title is also in the wrong place. Adjusting
the value of res_at_pmTitleZone does not change anything.

This still does not achieve what I wanted, which was simply to put
the x-axis label between the plot and the label bar.

Do you or anyone else know how I can do this ?. I enclose the current
plot and my current script.

Thanks,
Helen.

a) Current plot

b) Current script

;***********************
; timeavlatht.ncl
;***********************
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
;***********************
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"

begin

; Keep all files open when have a lot of files :
   setfileoption("nc","SuppressClose",False)

   diri = "./"
   fili = systemfunc("cd "+diri+" ; ls zeusrand09125*.cam2.h0*nc")
   print(fili)
   nfili = dimsizes(fili)

lev_p = (/ 91500., 90000., 87500., 80000., 67500., 50000., 30000.,
20000., 10000., 5000., 3000., 1500., 750., 390., 200., 100., 50.,25.,
14., 7., 3.5, 1.9, 0.95, 0.4, 0.1, 0.03 /)

   do nf = 0, nfili-1

   fi = addfile (diri+fili(nf), "r")

   diro = "./"
   filo = "helen"+nf+".nc"
   print(filo)
   system ("/bin/rm -f "+diro+filo) ; remove any pre-exist file
   fo = addfile (diro+filo, "c")

      hyam = fi->hyam ; read hybrid info
      hybm = fi->hybm
      hyai = fi->hyai ; read hybrid info
      hybi = fi->hybi
      PS = fi->PS
      P0mb = 0.01*fi->P0
      T = fi->T
      lat = fi->lat

   lev_p!0 = "lev_p" ; variable and dimension name
the same
   lev_p&lev_p = lev_p ; create coordinate variable
   lev_p_at_long_name = "pressure" ; attach some attributes
   lev_p_at_units = "hPa"
   lev_p_at_positive = "down"

      Tp = vinth2p (T, hyam, hybm, lev_p ,PS, 1, P0mb, 2, True)
      copy_VarAtts(T, Tp)
      fo->T = Tp ; write to netCDF file
  end do

   diri = "./"
   fili2 = systemfunc("cd "+diri+" ; ls helen*nc")
   print(fili2)
   nfili = dimsizes(fili2)

   f2 = addfiles (fili2,"r")
   T2= addfiles_GetVar(f2,fili2,"T")
   printVarSummary( T2 )

   dimt2 = dimsizes( T2 )
   ntim2 = dimt2(0)
   klvl2 = dimt2(1)
   nlat2 = dimt2(2)
   mlon2 = dimt2(3)

  tavg = dim_avg_Wrap(T2)

  tavg_reorder = tavg(lev_p | :, lat | :, time | :) ;
(lev,lat,time)

  ttimeav = dim_avg_Wrap(tavg_reorder) ; (lev,lat)

;***********************
; Create Plot
;***********************
  wks = gsn_open_wks ("eps", "Figure2a.test" ) ; open
workstation
   gsn_define_colormap(wks,"rainbow") ; choose colormap

   res = True
   res_at_cnFillOn = True
   res_at_lbLabelAutoStride = True
   res_at_gsnMaximize = True ; if [ps, eps, pdf] make large
   res_at_gsnSpreadColors = True ; span color map

   nt = 3 ; choose a time

     TTIMEAV = conform(tavg_reorder,ttimeav,(/0,1/)) ;
(lev,lat,time)

     work = ttimeav(:,:) ; time average at all levels and
latitudes

      res_at_gsnLeftString = ""
      res_at_gsnCenterString = "Time average of zonally averaged
temperature (K)"
      res_at_gsnRightString = ""

; res_at_pmTitleZone = 2
      res_at_pmTitleZone = 1

        pmLabelBarOrthogonalPosF = 0.05
; pmLabelBarOrthogonalPosF = 0.5
; tiXAxisOffsetXF = -0.10
        tiXAxisOffsetXF = 0.10

      res_at_tiXAxisString = "Latitude (degrees)"
      res_at_tiYAxisString = "Pressure (mbar)"

         res_at_lbTitleOn = True
         res_at_lbTitleDirection = "Across" ; title direction
         res_at_lbTitlePosition = "Right"
         res_at_lbTitleString = "(K)"
; res_at_lbTitleFontHeightF = 0.011
         res_at_lbTitleFontHeightF = 0.02
         res_at_lbTitleOffsetF = -0.02

      plot = gsn_csm_pres_hgt(wks, ttimeav(lev_p | 0:20, lat | :),
res ) ; (lev,lat)

      res_at_trYReverse = True

end

On Jun 15, 2009, at 7:41 AM, Mary Haley wrote:

> Helen,
>
> This is a shot in the dark, but can you try setting:
>
> res_at_pmTitleZone = 2
>
> You may need to try other values, like 1 and 3.
>
> --Mary
>
>
> On Sun, 14 Jun 2009, Helen Parish wrote:
>
>> Dear Adam,
>>
>> I am still trying to change the relative positions of the x-axis
>> label and the label bar, so that the x-axis label is immediately
>> below the x-axis, and the label bar is at the bottom of the plot.
>> In the plot I am enclosing below, this would mean that the label
>> "Latitude (degrees)" would be directly below the x-axis, and the
>> label bar would be below that.
>>
>> I tried the changes you suggested in your last email relating to
>> pmLabelBarOrthogonalPosF = 0.05 and tiXAxisOffsetXF = 0.10. (Your
>> reply is copied below). This seemed to have absolutely no effect
>> on the plot, even when I put different values in each statement.
>>
>> Can you or anyone else tell me what I need to do to change the
>> positions of these labels ?.
>>
>> I enclose my current plot and the corresponding script below.
>>
>> Your other responses (numbers 2 and 3 in your reply) worked well,
>> thanks !.
>>
>> Helen.
>>
>> a) My current plot
>>
>>
>
> --
> This message has been scanned for viruses and
> dangerous content by MailScanner, and is
> believed to be clean.
>
>

Received on Wed Jun 17 2009 - 07:00:35 MDT

This archive was generated by hypermail 2.2.0 : Fri Jun 19 2009 - 13:23:25 MDT