Re: Y-axis label and values

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Wed Jan 06 2010 - 10:22:43 MST

Kalim,

I tried a piece of your script on our "hov_1.ncl" example, and it
worked just fine. I got the month labels on the Y axis. This leads me
to believe that your "time" coordinate array is not in the range of
major_ticks. See the attached script and png file.

Your "major_ticks" array goes from 0.0 to 144.8. What is the range
of zAvgTime&time? What does print(zAvgTime&time) report?

If these values are not in the range of 0.0 to 144.8, then this is
what your problem is.

--Mary

On Jan 5, 2010, at 7:50 PM, kalim ullah wrote:

> 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
>
>
> <hov.pdf>

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Wed Jan 6 10:23:28 2010

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