- 积分
- 10605
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2013-10-10
- 最后登录
- 1970-1-1
|
发表于 2014-10-13 17:24:19
|
显示全部楼层
我把代码贴出来吧!刚控制了一下坐标的精度,好像是可以起作用的。
;*************************************************
; xy_8.ncl
;
; Concepts illustrated:
; - Forcing tickmarks and labels to be drawn on the top X axis in an XY plot
; - Changing the line dash pattern in an XY plot
; - Explicitly setting tickmarks and labels on the top X axis
;
;************************************************
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
;************************************************
begin
;************************************************
; read in data
;************************************************
fn = "SOI_Darwin.nc" ; define filename
in = addfile(fn,"r") ; open netcdf file
soi = in->DSOI ; get data
;************************************************
; calculate spectrum
;************************************************
spec = specx_anal(soi,0,7,0.10)
;************************************************
; plotting
;************************************************
wks = gsn_open_wks("newpng","xy") ; Opens a ps file
res = True ; plot mods desired
res@tiMainString = "Period (months/cycle)" ; title
res@tiXAxisString = "Frequency (cycles/month)" ; xaxis string
res@tiYAxisString = "Variance" ; yaxis string
; add additional axis on top of plot
res@tmXUseBottom = False ; Keep top axis independent of bottom.
res@tmXTLabelsOn = True ; have tick mark labels
res@tmXTOn = True ; have tick marks
res@tmXTMode = "Explicit" ; label independently
res@tmXTValues = (/0.0,0.10,0.20,0.30,0.40,0.50/)
xpts = fspan(0, 0.1, 5)
xpts := array_append_record(xpts, (/.2, .3, .4, .5/), 0)
res@xyXStyle = "Irregular"
res@trXAxisType = "IrregularAxis"
res@xyXIrregularPoints = xpts
res@tmXBPrecision = 3
plot=gsn_csm_xy(wks,spec@frq,spec@spcx,res) ; create plot
end
|
|