[ncl-talk] X Axis query

Kunal Bali kunal.bali9 at gmail.com
Fri Sep 26 06:16:57 MDT 2014


Dear NCL users

I tried to plot xy graph but one problem came out. If you see attached file
the X axis shows the years  like 04.0, 05.0, 06.0 ....etc

I need to convert x axis into 04,  05, 06, ...

I used the scripts


 load "/usr/local/lib/ncl/lib/ncarg/nclscripts/csm/gsn_code.ncl"
 load "/usr/local/lib/ncl/lib/ncarg/nclscripts/csm/gsn_csm.ncl"

begin
 x = new (8,float)
 y1 = new(8,float)
 y2 = new(8,float)

 x = (/04,05,06,07,08,09,10,11/)
 y1 =
(/3.53E+19,3.54E+19,3.51E+19,3.50E+19,3.54E+19,3.55E+19,3.51E+19,3.54E+19/)
 y2 = (/300.106,300.5,300.062,300.109,300.960,301.093,299.937,300.578/)

;---Open workstation and change color map
  wks_type = "pdf"
  wks_type at wkPaperSize = "B"
  wks = gsn_open_wks(wks_type,"xy")


; resources for "left" variable

 resL = True
 resL at gsnMaximize      = True
 resL at xyLineThicknesses = 3.            ; thicker line
 resL at xyLineColors = "blue"
 resL at tiYAxisString = "values1"
 resL at tiXAxisString = "YEARS"




; resources for "right" variable
 resR = True
 resR at xyLineThicknesses = 3.            ; thicker line
 resR at xyLineColors = "red"
 resR at tiYAxisString = "values2"

 plot = gsn_csm_xy2(wks,x,y1,y2,resL,resR)

end




Kunal Bali
Research Scholar
Radio & Atmospheric Science Division
CSIR - National Physical Laboratory
New Delhi - 110012
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20140926/f2c482b4/attachment-0001.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: xy.pdf
Type: application/pdf
Size: 52543 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20140926/f2c482b4/attachment-0001.pdf 


More information about the ncl-talk mailing list