Re: Y-axis label and values

From: kalim ullah <kalimrid_at_nyahnyahspammersnyahnyah>
Date: Tue Jan 05 2010 - 19:50:06 MST

Dear Mary, thanks for your response. Actually, I want to plot as example (hov_7.ncl:) but after some mudification I got the figure without label(i.e.month names) on y-axis ,so my plot is attached herewith.
thanks
kalim
--- On Tue, 1/5/10, Mary Haley <haley@ucar.edu> wrote:

From: Mary Haley <haley@ucar.edu>
Subject: Re: Y-axis label and values
To: "kalim ullah" <kalimrid@yahoo.com>
Cc: ncl-talk@ucar.edu
Date: Tuesday, January 5, 2010, 8:59 AM

Kalim,

If your tickmark labels are not showing up in "explicit" mode, then usually the problem is that the tickmark values you're using are not within the range of your axis values.

Since I can't run your script, I'm not sure what your Y axis values are.  You need to look at the arrays zAvgTime&time and major_ticks and make sure they are in the same data space.

major_ticks should be set to values that are within the range of your time values.

--Mary

On Jan 4, 2010, at 7:09 PM, kalim ullah wrote:

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

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

Received on Tue Jan 5 19:50:19 2010

This archive was generated by hypermail 2.1.8 : Wed Jan 06 2010 - 17:07:09 MST