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
b) My 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.paper" ) ; 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 = ""
pmLabelBarOrthogonalPosF = 0.05
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.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 3, 2009, at 8:10 AM, Adam Phillips wrote:
> Hi Helen,
>
> (see below)
>
> Helen Parish wrote:
>> Can anyone tell me how to make the following adjustments to my
>> plot ? :
>> 1. How do I put the x-axis title "Latitude (degrees)" in between
>> the bottom of the plot and the color bar, rather than at the very
>> bottom of the entire plot ? (right now the x-axis title is
>> labeling the wrong thing ! ).
>
> You need to move the labelbar down and/or the x-axis title up. Try
> setting
> pmLabelBarOrthogonalPosF = 0.05
> http://www.ncl.ucar.edu/Document/Graphics/Resources/
> pm.shtml#pmLabelBarOrthogonalPosF
> along with tiXAxisOffsetXF = 0.10
> http://www.ncl.ucar.edu/Document/Graphics/Resources/
> ti.shtml#tiXAxisOffsetXF
>
>> 2. I want to put units into the title. If I want to make the units
>> meters per second, for example, and I want to use a superscript,
>> so it says "m s-1" rather than "m/s" , how can I do this ?.
>> (note that I cannot write m s-1 properly in this email message,
>> for the same reason that I cannot write this properly in the title).
>
> Assuming you are loading the default .hluresfile, where your
> function code is set to ~, then this should work:
> tiMainString = "m s~S~-1~N~"
>
> The ~S~ puts the font in superscript mode, and the ~N~ put the font
> back to normal.
> http://www.ncl.ucar.edu/Document/Graphics/function_code.shtml
>
>> 3. I want units next to the color bar. Worse still, I want to be
>> able to put units with a superscript next to the color bar. In
>> other words, I want to be able to put something like "m
>> s-1" (written in superscript form) next to the numbers on the
>> color bar, so that people know what the numbers on the color bar are.
>
> You are going to want to set the lbTitleString. Here is a set of
> resources that I commonly use that setup the labelbar title to the
> right of the labelbar:
>
> sres_at_lbTitleOn = True
> sres_at_lbTitleDirection = "Across" ; title direction
> sres_at_lbTitlePosition = "Right"
> sres_at_lbTitleString = "(%)"
> sres_at_lbTitleFontHeightF = 0.011
> sres_at_lbTitleOffsetF = -0.02
>
> http://www.ncl.ucar.edu/Document/Graphics/Resources/lb.shtml#lbTitleOn
>
> Good luck,
> Adam
>
>
>> I am enclosing a sample plot, and the script I used to create it
>> (in this case for temperature, but I have wind plots too).
>> Thanks,
>> Helen.
>> ;***********************
>> ; temploop.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 ("pdf", "temploop.test.
>> 165to175" ) ; 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"
>> res_at_gsnRightString = ""
>> res_at_tiXAxisString = "Latitude (degrees)"
>> res_at_tiYAxisString = "Pressure (mbar)"
>> plot = gsn_csm_pres_hgt(wks, ttimeav(lev_p | 0:20, lat | :),
>> res ) ; (lev,lat)
>> res_at_trYReverse = True
>> end
>> ---------------------------------------------------------------------
>> ---
>> _______________________________________________
>> ncl-talk mailing list
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
> --
> --------------------------------------------------------------
> Adam Phillips asphilli_at_ucar.edu
> National Center for Atmospheric Research tel: (303) 497-1726
> ESSL/CGD/CAS fax: (303) 497-1333
> P.O. Box 3000
> Boulder, CO 80307-3000 http://www.cgd.ucar.edu/cas/asphilli
>
> --
> This message has been scanned for viruses and
> dangerous content by MailScanner, and is
> believed to be clean.
>
>
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
This archive was generated by hypermail 2.2.0 : Mon Jun 15 2009 - 08:53:05 MDT