label the x-axis

From: Bidyut Bikash Goswami <bidyut_at_nyahnyahspammersnyahnyah>
Date: Sun Nov 04 2012 - 00:35:22 MDT

 Hi, all

 I have a plot with 12 panels. I want to label the x-axis only for the bottom four panels.

 Please give me some suggestions on this. Thanks a lot.

 Below the code is given.
 
Nabanita
Senior Research Fellow
Indian Institute Of Tropical Meteorology
Climate & Global Modeling Division
Dr. Homi Bhabha Road, Pashan
Pune-411008
Tel:+91-20-25904510
email id: nabanitaborah@gmail.com ,
nita@tropmet.res.in

;***********************************************************
; Plot Phase Space Diagram
;***********************************************************
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/diagnostics_cam.ncl"

begin

dd=asciiread("daily_stdanom_rf_all.dat",(/7320,27/),"float")

rf=dd(:,0)
va=dd(:,1:

  dum= pdfxy(rf,va(:,0),0,0,False)
  dim=dimsizes(dum)
  nx=dim(1)
  ny=dim(0)
  nvar=26
  zz=new((/nvar,nx,ny/),typeof(dum))
  do i= 0 ,nvar-1
  print("var = "+i)
   dum2=pdfxy(rf,va(:,i),0,0,False)
   zz(i,:,=dum2
   delete(dum2)
  end do
  
  printVarSummary(zz)

;--------------------------------------------------
; ploting
;--------------------------------------------------
  
  plot = new (nvar, "graphic")
  wks = gsn_open_wks("eps","Bivariate_pdf_new")
; gsn_define_colormap(wks,"amwg") ; choose colormap
  gsn_define_colormap(wks,"gray")

  res = True
  res@gsnDraw = False
  res@gsnFrame = False
  res@cnInfoLabelOn = False
  res@cnFillOn = True
  res@lbLabelBarOn = False
  res@lbAutoManage = False
  res@tmYUseLeft = False ; Make right axis independent of left
  res@tmYROn = False ; Turn on right tickmarks
  res@tmXTOn = False ; Turn off top tickmarks
  res@cnLineLabelsOn = False ; turn off contour line labels
 
  res@tmXBMode = "Explicit"
  res@tmXBValues = (/-3,-2,-1,0,1,2,3,4/)
  res@tmXBLabels = (/"-3","-2","-1","0","1","2","3","4"/)
  res@tmYLMode = "Explicit"
  res@tmYLValues = (/-4,-2,0,2,4/)
  res@tmYLLabels = (/"-4","-2","0","2","4"/)
  res@tmYLMinorOn = False ; No minor tick marks.
; res@tmXBMinorOn = False ; No minor tick marks.
  res@tmXBMajorOutwardLengthF=0.0
  res@tmYLMajorOutwardLengthF=0.0
; res@tmYBMinorValues = ispan(-2,4,1)
  
  res@lbLabelStride=1
  res@trXMinF = -3.0 ; Limits for Y axis. The limits
  res@trXMaxF = 4.0 ; for the X axis will be different
  

;--------------------------------------------------
; Contour lines settings

  res@gsnSpreadColors = True ; use full color map
  res@gsnSpreadColorStart = 0
  res@gsnSpreadColorEnd = 102 ; don't use added gray
  
 
;--------------------------------------------------
; Add another text string. Y-axis label for each panel
;--------------------------------------------------

  txres = True ; text mods desired
  txres@txBackgroundFillColor = "White"
  txres@txFontHeightF = 0.03 ; font smaller. default big
  txres@txAngleF = 90.0 ; Rotate the text 90 deg. counter-clockwise.
 
  do i=0,nvar-1
  
   plot(i) = gsn_csm_contour (wks,zz(i,:,, res)
  
   amres = True
   amres@amParallelPosF =-0.48 ; This is the right edge of the plot.
   amres@amOrthogonalPosF =-0.26 ; This is the bottom edge of the plot.
   amres@amJust = "TopLeft"
 
   txid = gsn_create_text(wks, "Variable "+(i+1), txres)

   annoid = gsn_add_annotation(plot(i), txid, amres)
 
  end do

;--------------------------------------------------
; create panel
;--------------------------------------------------
  resP = True
  res@gsnPaperOrientation = "portrait"
  resP@gsnMaximize = False ; modify the panel plot
  resP@txString = ""
  resP@gsnPanelRowSpec = True ; tell panel what order to plt
  resP@pmLabelBarWidthF=0.5
  resP@lbLabelFontHeightF=0.007
  resP@gsnPanelLabelBar = True ; add common colorbar
  
  res@gsnPanelBottom = 0.3
  res@gsnPanelXWhiteSpacePercent = 5.
 
; gsn_panel(wks,plot,(/3,4,4,4,4,4,3/),resP)
  gsn_panel(wks,plot,(/4,4,4/),resP)
  print("plot = "+i)

end

========================================
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Sun Nov 4 00:46:43 2012

This archive was generated by hypermail 2.1.8 : Tue Nov 06 2012 - 15:05:49 MST