Hi all,
Here is my code as follo. I want to mark the top axis with the same tick mark but different labels, such as 10^4 10^3 10^2 10. How should I modify the code? Thanks.
;*************************************************
; spec_3.ncl
;************************************************
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"
;************************************************
begin
;************************************************
; variable and file handling
;************************************************
sec1 = "KS" ; define section name
sec2 = "BS"
sec3 = "MS"
sec4 = "LS"
pic_name = "SCS"+"_spec"
wks_type = "eps"
post = "_daily.dat.bak"
data = asciiread(sec1+post,(/4017,2/),"float")
x1 = data(:,1)
data = asciiread(sec2+post,(/4017,2/),"float")
x2 = data(:,1)
data = asciiread(sec3+post,(/4017,2/),"float")
x3 = data(:,1)
data = asciiread(sec4+post,(/4017,2/),"float")
x4 = data(:,1)
;************************************************
; set function arguments
;************************************************
iopt = 0 ; detrending opt: 0=>remove mean 1=>remove mean + detrend
sm = 2 ; smooth: should be at least 3 and odd ;jave
pct = 0.10 ; percent taper: (0.0 <= pct <= 1.0) 0.10 common.
;************************************************
; calculate spectrum
;************************************************
dof1 = specx_anal(x1,iopt,sm,pct)
dof2 = specx_anal(x2,iopt,sm,pct)
dof3 = specx_anal(x3,iopt,sm,pct)
dof4 = specx_anal(x4,iopt,sm,pct)
plt1 = specx_ci(dof1, 0.05, 0.95) ; calc confidence interval
plt2 = specx_ci(dof2, 0.05, 0.95) ; calc confidence interval
plt3 = specx_ci(dof3, 0.05, 0.95) ; calc confidence interval
plt4 = specx_ci(dof4, 0.05, 0.95) ; calc confidence interval
frq = dof1@frq
;************************************************
; plotting parameters
;************************************************
wks = gsn_open_wks(wks_type,pic_name) ; Opens a ps file
plot = new(4,graphic) ; create graphic array
r = True ; plot mods desired
r@gsnDraw = False ; do not draw
r@gsnFrame = False ; do not advance frame
r@tiYAxisString = "PSD (Sv**2/cpd)" ; yaxis
r@xyLineThicknesses = (/2.,1.,1.,1./) ; Define line thicknesses
r@xyDashPatterns = (/0,0,1,1/) ; Dash patterns
r@trYLog = True
r@trXLog = True
r@trYMinF = 0.01
r@trXMaxF = 0.2
r@trXMinF = 0.0001
r@xyLineColors = (/"foreground","blue","red","red"/)
r@tmXUseBottom = False
; r@tmXTOn = True
; r@tmXTLabelsOn = True
r@tmXTMode = "Explicit"
r@tmXTValues = (/1e-4,1e-3,1e-2,1e-1/)
r@tmXTLabels = (/"10~S~4","10~S~3","10~S~2","10~S~1"/)
r@tmXTMinorOn = True
; r@tmXTStyle = "Log"
r@vpWidthF = 0.5
r@vpHeightF = 0.3
;************************************************
; first plot
;************************************************
; plot(0)=gsn_csm_xy(wks, dof1@frq, sdof@spcx, r) ; create plot
r@tiMainString = sec1 ; title
plot(0)=gsn_csm_xy(wks, frq, plt1, r) ; create plot
;***********************************************
; second plot: Generate quick-n-dirty plot showing
; 5 and 95% "red noise" confidence
; bounds
;***********************************************
r@tiYAxisString = "" ; yaxis
r@tiMainString = sec2 ; title
plot(1) = gsn_csm_xy(wks,frq, plt2,r)
;***********************************************
; Third Plot: Generate fancier plot showing
; "red noise" confidence bounds
; (a) solid for spectrum and Markov,
; (b) dash for bounds
;***********************************************
r@tiXAxisString = "Frequency (cpd)" ; xaxis
r@tiYAxisString = "PSD (Sv**2/cpd)" ; yaxis
r@tiXAxisOn = True
r@tiMainString = sec3 ; title
plot(2) = gsn_csm_xy(wks,frq, plt3,r)
;***********************************************
; Fouth Plot: Generate color plot showing
; "red noise" confidence bounds
;***********************************************
r@tiYAxisString = "" ; yaxis
r@tiMainString = sec4 ; title
plot(3) = gsn_csm_xy(wks,frq, plt4,r)
;***********************************************
res_P = True ; panel mods desired
res_P@gsnMaximize = True ; blow up plot
res_P@vpWidthF = 0.3
res_P@vpHeightF = 0.8
gsn_panel(wks,plot,(/2,2/),res_P) ; create panel plots
end
2013-11-15
Xueming Zhu 朱学明
Key Laboratory of Research on Marine Hazards Forecasting (LoMF), SOA
National Marine Environmental Forecasting Center (NMEFC)
No.8, Dahuisi Road, Haidian District, Beijing, 100081
People's Republic of China
Tel:+86-10-82481923
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Thu Nov 14 22:14:09 2013
This archive was generated by hypermail 2.1.8 : Fri Nov 22 2013 - 09:36:32 MST