Adding an x-axis label

From: James Correia <jimmyc42_at_nyahnyahspammersnyahnyah>
Date: Thu Aug 11 2011 - 11:01:58 MDT

Hi -
I am making meteograms and for some reason can't get the x-axis labels to
show up. The code is below. I have 3 panels that I construct for
temperature/dew point, wind, and pressure/precip. I turn off the x labels
and x axis string for the first two panels and then turn them back on for
the third. A pdf is attached to illustrate this issue. This is a shorter
time series but I also added the ability to have shaded light gray regions
when it is longer so I added the tfPolyDrawOrder resource.

Am I just forgetting to turn a resource back on or is one resource
interfering with another?
Thanks for any help
jimmyc

NCL code:
plot = new(3,graphic)

 res = True ; plot mods desired
 res@tfPolyDrawOrder = "PreDraw"
  res@gsnMaximize = True ; maximize plot
  res@tiMainString = stn(i)+" "+date ; add title
  res@xyMarkLineMode = "Lines" ; choose to use markers
  res@vpHeightF= 0.4 ; change aspect ratio of plot
  res@vpWidthF = 0.9

  res@tiXAxisString = "Hours" ; default is long_name (if present)
  res@tmYLLabelsOn = True
res@gsnPaperOrientation = "Portrait"
res@gsnFrame = False
res@gsnDraw = False
res@trXMinF = tstart
res@trXMaxF = tend
print(min(relh(ih))+" "+max(temp(ih)))
res@trYMinF = 10. ;min(dewa)
res@trYMaxF = 40. ;max(tmpa)
  delete(res@tiXAxisString)
  res@tiYAxisString = "T/Td" ; default is long_name (if present)
  res@xyLineColor = "Red"
  res@tmXBLabelsOn = False
  plot(0) = gsn_csm_xy (wks,daysa(ih),temp(ih),res)
  res@xyLineColor = "Green"
  plot1 = gsn_csm_xy (wks,daysa(ih),relh(ih),res)
overlay(plot(0),plot1)

  delete(res@tiMainString)

  res@tiYAxisString = "W/G" ; default is long_name (if present)
  res@xyLineColor = "Blue"
  res@trYMinF = 0.
  res@trYMaxF = 30.
  res@tmXBLabelsOn = False
  plot(1) = gsn_csm_xy (wks,daysa(ih),spd(ih),res)
  res@xyLineColor = "Green"
  plot1 = gsn_csm_xy (wks,daysa(ih),gus(ih),res)

 resV = True
  resV@gsnDraw = False ; do not draw
  resV@gsnFrame = False ; do not advance the frame
  resV@vcGlyphStyle = "LineArrow" ;"WindBarb" ;"LineArrow"
  resV@vcRefLengthF = 0.1 ; define length of vec ref
  resV@vcRefAnnoOn = False ; turn off ref wind barb
  resV@vcWindBarbLineThicknessF= .5 ; set the wind barb
thickness
  resV@vcRefMagnitudeF = 10.
  resV@vfXArray = da
  resV@vfYArray = ispan(0,29,1)
  resV@vcMapDirection = False ; needed to disassociate the map from the
vectors
  plota = gsn_vector(wks,u,v,resV)

overlay(plot(1),plot1)
overlay(plot(1),plota)

res@trYMinF = 0 ;min(presa(ih))
res@trYMaxF = 10 ;min(presa(ih))+8.
  res@tmXBLabelsOn = True
  res@tiXAxisString = "Hours" ; default is long_name (if present)

  res@tiYAxisString = "Pres/Prec" ; default is long_name (if present)
  res@xyLineColor = "Red"
  plot(2) = gsn_csm_xy(wks,daysa(ih),presa(ih)-min(presa(ih)),res)
  res@tmYLLabelsOn = False
  res@xyLineColor = "Blue"
res@trYMinF = 0.
res@trYMaxF = 10.
plot1 = gsn_csm_xy (wks,daysa(ih),prea,res)
overlay(plot(2),plot1)

;;;;;;; First get min/max values of each Y axis
  ymin = new(3,float)
  ymax = new(3,float)
 ; xmin = new(3,float)
 ; xmax = new(3,float)
  do l=0,2
    getvalues plot(l)
      "trYMinF": ymin(l)
      "trYMaxF": ymax(l)
    end getvalues
  end do

;;;;;; Set up arrays to hold bar coordinates

  xmin = (/0.,6.,12./)
  xmax = xmin + 3.0

  xbars = (/ (/xmin(0), xmax(0), xmax(0), xmin(0), xmin(0)/), \
             (/xmin(1), xmax(1), xmax(1), xmin(1), xmin(1)/), \
             (/xmin(2), xmax(2), xmax(2), xmin(2), xmin(2)/)/)

  ybars = (/ (/ymin(0),ymin(0),ymax(0),ymax(0),ymin(0)/), \
             (/ymin(1),ymin(1),ymax(1),ymax(1),ymin(1)/), \
             (/ymin(2),ymin(2),ymax(2),ymax(2),ymin(2)/)/)

;;;;;; Create the bars and attach to appropriate plot
  gres = True
  light_gray = NhlNewColor(wks,0.85,0.85,0.85)
  gres@gsFillColor = light_gray
poly = new(9,graphic)
  do l=0,2
    do o=0,2
      poly((l*3)+o) =
gsn_add_polygon(wks,plot(o),xbars(l,:),ybars(o,:),gres)
    end do
  end do

  pres = True
  pres@gsnFrame = True
  pres@gsnMaximize = True
; pres@gsnPanelBottom = 0.16
; pres@gsnPanelTop = 0.98
; pres@gsnPanelFigureStrings = (/"a","b","c"/)
; pres@gsnPanelFigureStringsPerimOn = False
gsn_panel(wks,plot,(/3,1/),pres)

-- 
------------------------------------------------------------------------------------------
The views expressed in this email do not necessarily reflect those of NOAA,
the National Weather Service, or the University of Oklahoma.
------------------------------------------------------------------------------------------
James Correia Jr.
OU CIMMS Research Associate
SPC HWT Liaison


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

Received on Thu Aug 11 11:02:06 2011

This archive was generated by hypermail 2.1.8 : Fri Aug 12 2011 - 11:48:30 MDT