Kalim,
run following script and change YLValues to yours.
Yongzuo
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
begin
wks = gsn_open_wks("pdf","ike-minslp")
x = new((/4/),float)
x(:) =(/0,6,12,18/)
y = new((/4,4/),integer)
y(0,:) =(/951,959,974,980/)
y(1,:) =(/960,969,979,984/)
y(2,:) =(/979,980,985,987/)
y(3,:) =(/967,973,983,990/)
res = True ; plot mods desired
res@tiMainString = "Hurricane ike minSLP (hPa)" ; add title
res@tiYAxisString = "minSLP (hPa)" ; which is helvetica
res@tiXAxisString = "Forecast time (hours)" ; the font to "22"
res@tmYROn = False
res@tmXTOn = False
res@pmTickMarkDisplayMode = "Always"
res@tmXBMinorOn = True
res@tmYLMinorOn = True
res@tmXBMode = "Explicit"
res@tmXBLabels = (/"1306","12","18","1400"/)
res@tmXBValues = (/"0","6","12","18"/)
res@tmYLMode = "Explicit" ; explicitly set Y-axis labels
res@tmYLValues = (/"950","955","960","965","970","975","980","985","990"/)
res@tmYLLabels = (/"950","955","960","965","970","975","980","985","990"/)
res@xyLineThicknesses = (/3.0,3.0,3.0,3.0/) ; make 2nd lines thicker
res@xyLineColors = (/"black","red","green","blue"/) ; change line color
res@xyDashPatterns = (/0.0,0.0,0.0,0.0/)
plot = gsn_xy(wks,x,y,res) ; create plot
end
From: kalim ullah [kalimrid@yahoo.com]
Sent: Tuesday, January 05, 2010 6:57 AM
To: Li, Yongzuo
Cc: ncl-talk@ucar.edu
Subject: Re: ncl-talk Digest, Vol 74, Issue 5
Dear Li Yongzuo, thanks for your answer. Actually, I want to label month names and also number of days on y -axis. Please your response will be appreciated in this regard.
thanks
kalim
--- On Mon, 1/4/10, Li, Yongzuo <yongzuo.li@ou.edu> wrote:
From: Li, Yongzuo <yongzuo.li@ou.edu>
Subject: Re: ncl-talk Digest, Vol 74, Issue 5
To: "ncl-talk@ucar.edu" <ncl-talk@ucar.edu>
Date: Monday, January 4, 2010, 6:58 PM
<!--
#yiv144205549 p
{margin-top:0;
margin-bottom:0}
-->
BODY {direction: ltr;font-family: Tahoma;color: #000000;font-size: 13px;}P {margin-top:0;margin-bottom:0;}
Answer to 4. axis
res@pmTickMarkDisplayMode = "Always"
res@tmYLMinorOn = True
res@tmXBMinorOn = True
Yongzuo
Today's Topics:
1. Re: trouble with Cygwin Install Fix (Allison Yanites)
2. Re: trouble with Cygwin Install Fix (Rick Brownrigg)
3. Questions about convergence or divergence from WRF Output,
Thanks! (Xiaoming Sun)
4. Y-axis label and values (kalim ullah)
Dear NCL Users,
I?m trying to plot time vs lon figure but after plotting there is no Y-axis labels and values appear and also no error. Please could you help me in this regard? My script is attached given below:
Thanks in advance
kalim
******************************
?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
;=============================================
; data processing
;=============================================
?? f = addfile("lhtfl.sfc.gauss.2007.nc","r")
?? z = short2flt(f->lhtfl(0:149,:,:))???? ;AUG(1-5)
?? printVarSummary(z)
?? zAvgTime = dim_avg_Wrap(z(time|:,lon|:,{lat|0:40}))
?? printVarSummary(zAvgTime)
?
?? wks? = gsn_open_wks ("x11", "hov" )
?? gsn_define_colormap(wks,"BlAqGrYeOrRe")
?? ;*******************************
?? res??????????? = True????????????????????????
?? res@cnFillOn????????????? = True?
?? months????? = (/1,? 2,??? 3,?? 4,?? 5/)?? ???
?? years?????? = (/2007,2007,2007,2007,2007/)
?? tk_per_mon? = 5 ; Tickmarks per month.
?? nmonths???? = dimsizes(months)
?? ndays?????? = nmonths * tk_per_mon
?
?? day_in_mon? = new(nmonths,float)?????????? ; Number of days in each month
?? do i=0,nmonths-1
?? day_in_mon(i) = days_in_month(years(i),months(i))*1.
?? end do
?
?? major_ticks = new(ndays,float)??? ; Array to hold major tickmark values.
?? imonth????? = 0
?? days_accum? = 0.
?? ii4???????? = ispan(1,4,1)*1.
?? do i=0,ndays-1,5
?? major_ticks(i) = days_accum
?? major_ticks(i+1:i+4) = major_ticks(i) + ii4*(day_in_mon(imonth)/tk_per_mon)
?? days_accum???? = days_accum + day_in_mon(imonth)
?? imonth = imonth + 1
?? end do
?? ;*********************************
?? res@cnLinesOn??????? ?????= False
?? res@gsnSpreadColors?????? = True
?? res@cnLevelSelectionMode = "ManualLevels"
?? res@cnMinLevelValF?????? = -10.?????????????? ; min level
?? res@cnMaxLevelValF?????? =? 100.?????????????? ; max leve
?? res@lbOrientation???????? = "Vertical"
?? res@gsnLeftString???????? = "Latent Heat Net Flux(W/m^2)"
?? res@gsnRightString?????? = ""
?? res@tmYLMode?????????? = "Explicit"???????? ; Define own tick mark labels.
?? res@tmYLMinorValues??? = major_ticks(0:ndays-1:5)
?? res@tmYLValues???????? = major_ticks
?? res@tmYLLabels???????? = new(ndays,string)
?? res@tmYLLabels(:)???? = ""
?
; Label mid tickmark with the month label.
?? res@tmYLLabels(3::5)? = (/"JAN", "FEB", "MAR", "APR", "MAY"/)
?
?? res@tmYLMinorOutwardLengthF = 0.02??? ; Increase length and size of
?? res@tmYLMinorLengthF??????? = 0.02??? ; minor tickmarks
?? res@tmYLMinorThicknessF???? = 2.0
?? res@tmYLMajorOutwardLengthF = 0.01
?? res@tmYLMajorLengthF??????? = 0.01
?? plot = gsn_csm_hov(wks, zAvgTime(:,{30:120}) , res )
?? end
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20100104/5d67339c/attachment.html
------------------------------
_______________________________________________
ncl-talk mailing list
ncl-talk@ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
End of ncl-talk Digest, Vol 74, Issue 5
***************************************
-----Inline Attachment Follows-----
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Tue Jan 5 10:07:04 2010
This archive was generated by hypermail 2.1.8 : Wed May 26 2010 - 10:39:13 MDT