load "$NCARG_ROOT/lib/ncarg/nclscripts/contrib/time_axis_labels.ncl" begin filename = "ts_Amon_CESM1-CAM5_historical_r1i1p1_185001-200512.nc" a = addfile(filename,"r") temp = a->ts tavg = dim_avg_Wrap(temp) ; average across longitude tavg = tavg-273.15 ; convert from Kelvin->Celsius tavg@units = "degC" lats = (/0, 25, 55/) nlat = dimsizes(lats) ntim = dimsizes(tavg&time) tavg_multi = new((/nlat,ntim/),typeof(tavg)) do n=0,nlat-1 tavg_multi(n,:) = tavg(:,{lats(n)}) end do wks = gsn_open_wks("png","time1f") res = True res@gsnMaximize = True res@vpWidthF = 0.9 res@vpHeightF = 0.3 res@trXMaxF = max(tavg&time) res@tiMainString = "Average " + tavg@long_name + " (" + \ tavg@units + ") at lats = " + str_join(""+lats,",") res@tiMainFontHeightF = 0.02 res@tiYAxisString = "" res@xyMonoDashPattern = True ; Use solid lines for all curves res@xyLineColors = (/"black", "blue","green"/) res@xyLineThicknesses = (/ 3., 2., 2.0/) ;---Format the tickmark labels res@tmXBLabelFontHeightF = 0.01 res@tmXBMinorOn = False res@tmYLMinorOn = False res@tmYLFormat = "f" res@tmXTOn = False res@tmYROn = False ;---Add nice time labels on X axis rest = True rest@ttmFormat = "%c %Y" rest@ttmNumTicks = 10 time_axis_labels(tavg&time,res,rest) plot = gsn_csm_xy(wks,tavg&time,tavg_multi,res) end