Re: give tick marks on a longitude-time plot

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Sun Nov 03 2013 - 20:21:53 MST

Yi-Chih,

The answer to why your tickmarks didn't show up is because you were using values for the "tmYLValues" resource that were not in the same data space as your Y axis.

What Dennis did via his attached script was to simply replace your time axis coordinate array with your "yr" array.

  ntim = dimsizes(pcp&time)
  yr = ispan(1,ntim,1)
  yr@long_name = "months"
  delete(pcp&time)
  pcp&time = yr

--Mary

On Nov 1, 2013, at 9:22 PM, Dennis Shea <shea@ucar.edu> wrote:
>
> On 11/1/13 5:18 PM, Yi-Chih Huang wrote:
>> Hello,
>>
>> I am working on a longitude-time plot. The values of time are from
>> 66505 to 67204. So I want to give 1-48 (months) instead on y-axis. I have
>> read and tried the examples on NCL web site. However, the y axis is still
>> blank. Could you tell me what is wrong with the syntaxs below?
>>
>> Thanks much,
>>
>> Yi-Chih
>>
>> ####
>> load "$SysE/lib/ncl/helper_libs.ncl"
>>
>> begin
>> in= addfile("/fs3/yhuang/precip.mon.mean.nc","r") ; 197901-201306
>> precip= in->precip
>>
>> precs= precip(time|:,{lat|5:-5},{lon|120:240}) ; Indian Ocean
>> prect= precs(37:60,:,:) ; 1982-1983
>> pcp= dim_avg_n_Wrap( prect,1 )
>> printVarSummary(pcp)
>>
>> wks= gsn_open_wks("X11","pcpTime")
>> gsn_define_colormap(wks,"BlueRed")
>>
>> res = True
>> res@gsnAddCyclic = False
>> res@cnFillOn = True
>> res@gsnSpreadColors = True
>> res@gsnSpreadColorStart = 10
>> res@gsnSpreadColorEnd = 250
>> res@cnSpanFillPalette = True
>> res@cnLinesOn = False
>> res@gsnDraw = True
>> res@tmYLLabelsOn = True
>> yr = ispan(1,48,1)
>> yl= tostring(yr)
>> res@tmYLMode = "Explicit"
>> res@tmYLValues = yr
>> res@tmYLMinorValues = yr
>> res@tmYLLabels = "" + res@tmYLValues
>>
>> res@lbLabelBarOn = True
>> res@pmLabelBarWidthF= 0.6
>>
>> plot = gsn_csm_hov(wks, pcp, res)
>> end
>>
>>
>>
>> _______________________________________________
>> ncl-talk mailing list
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>
> <yichih_huang.ncl>_______________________________________________
> 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 Sun Nov 3 20:22:05 2013

This archive was generated by hypermail 2.1.8 : Mon Nov 11 2013 - 09:45:34 MST