Re: Tick Mark question: Start at "1" instead of "0"

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Wed Dec 09 2009 - 16:23:26 MST

Hi Erik,

This is not a Y axis issue, but rather an issue with your Y
coordinate array.

If you do:

   printVarSummary(r2)

what does it say the range is for the Y coordinate values? If they
are equally spaced and start at 0, then maybe you simply just need to
add 1 to that array:

    r2&time = r2&time + 1

I'm assuming the coordinate array is called "time", so you'll have to
change this to whatever it is for r2.

Here's another way, if you don't want to change the time values.
You'll have to relabel the Y axis yourself, and tell it not to go to 30:

   res@trYMaxF = 29
   res@tmYLMode = "Explicit"
   res@tmYLValues = ispan(0,25,5) ; change to wherever you
want tickmarks
   res@tmYLLabels = "" + ispan(1,26,5) ; or whatever labels you
want.

Note that if you do the second method, you will no longer get minor
tickmarks.

--Mary

On Dec 9, 2009, at 10:43 AM, Erik Noble wrote:

> Dear NCL,
> The y-axis on my plot starts at zero. I want to make is start at 1.
> What command helps me change this? I'm plotting a time vs.
> longitude plot. My y-axis is supposed to be for 30 days but at the
> moment it looks like 29 days and it leaves white space at the top
> of my plot.
> Any help would b greatly appreciated. Thank you.
> -Erik<Picture 15.png>
>
>
>
>
> ;NCL CODE
>
> 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"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"
> diri = "./"
> fili="wrfout_NCEP2_0820_1001_default_PleimXiu_DAILY-
> RAIN_Diagnostics_SEP_10dSp.nc_Continuous_Daily_PrecipTotals.nc"
> a = addfile(diri+fili,"r")
> rain = a->daily_accum_cum
> rain_R2 = rain(:,{12.5:17.5},{-15:30})
> r2= dim_avg_n_Wrap(rain_R2,1)
> ;************************************************
> ; create plot
> ;************************************************
> type = "ps" ;
> create variable to hold info
> type@wkColorModel = "cmyk" ;
> make output cmyk
> wks = gsn_open_wks(type,"wrf_PX_rainHov_R1") ; open a ps file
> gsn_define_colormap(wks,"BlAqGrYeOrRe") ; choose colormap
>
> res =
> True ;
> plot mods desired
> ;******************* Use These next set of commands if using color
> res@cnFillOn = True ; turn on
> color fill
> res@gsnSpreadColors = True ; use full range of
> colors
> res@cnLinesOn = False ; turn off contour lines
> res@cnLineLabelsOn = False ; turn off line labels
> ; CMYK colors
> ;res@gsnSpreadColorStart = 10 ; start at color 10
> ;res@gsnSpreadColorEnd = 65
> ;*******************
> res@cnLevelSelectionMode = "ManualLevels" ; set manual
> contour levels
> res@cnMinLevelValF = 0.
> res@cnMaxLevelValF = 60.
> res@cnLevelSpacingF = 5.
>
> res@tiMainString = "Daily Accumulated Precipitation: Region 1"
> res@tiXAxisString = "Longitude"
> res@gsnMajorLonSpacing = 5.
> ;res@tmXBTickSpacingF = 5
> res@tiYAxisString = "Elapsed Time: SEP 2006"
> res@gsnLeftString = "Average over Lats: 12.5N to 17.5N"
> res@pmTickMarkDisplayMode = "Always"
>
> plot = gsn_csm_hov(wks,r2,res)
>
> _______________________________________________
> 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 Wed Dec 9 16:23:31 2009

This archive was generated by hypermail 2.1.8 : Thu Dec 10 2009 - 11:30:59 MST