- 积分
- 8040
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2011-9-7
- 最后登录
- 1970-1-1
|
登录后查看更多精彩内容~
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
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"
procedure add_line(wks,plot,x,y)
local res_line, str
begin
res_line = True
res_line@xyDashPatterns = 16 ; dashed line for 2nd
res_line@xyLineThicknesses = 3 ; thicker line
str = unique_string("polyline") ; "unique_string" will return a unique
; string every time it is called from
; within a single NCL session.
;
; You can then use this unique string as an attribute variable name
; that gets attached to the plot variable. This ensures that this
; value will live for the duration of the script.
;
plot@$str$ = gsn_add_polyline(wks, plot, x, y, res_line)
end
;---------------仿照例子定义一个add_line的procedure,用来画对角线,输入的参数是wks, plot, x和y
begin
Rn_path="/home/zhaojc/work/863/Rn/"
f_Rn_cam=addfile(Rn_path+"Rn_cam_dot.nc","r")
var_Rn_cam=f_Rn_cam->Rn_cam_dot
f_Rn_rs=addfile(Rn_path+"Rn_rs.nc","r")
var_Rn_rs=f_Rn_rs->Rn_rs
x_Rn=var_Rn_cam
y_Rn=var_Rn_rs
;--------------------------------------将要化的数据读取出来---------------------------------------------
xx_Rn = ispan (60,72,1)
yy_Rn = xx_Rn
;--------------------------------------生成准备画对角线的数据------------------------------------------------------
wks = gsn_open_wks ("pdf","scatter") ; open workstation
res_Rn = True
res_Rn@xyMarkLineMode = "Markers" ; choose to use markers
res_Rn@xyMarkers = 16 ; choose type of marker
res_Rn@xyMarkerColor = "Black" ; Marker color
res_Rn@xyMarkerSizeF = 0.01 ; Marker size (default 0.01)
res_Rn@trXMinF = 60
res_Rn@trYMinF = 60
res_Rn@trXMaxF = 72
res_Rn@trYMaxF = 72
res_Rn@gsnFrame = False ; don't advance frame yet
res_Rn@tiXAxisString = "ERA-40"
res_Rn@tiXAxisFont = 25
res_Rn@tiYAxisString = "calculation"
res_Rn@tiYAxisFont = 25
plot = gsn_csm_xy (wks,x_Rn,y_Rn,res_Rn)
;---------------------------------------------------画散点图------------------------------------------------------------------
add_line(wks,plot,xx_Rn,yy_Rn)
;---------------------------------------------------调用add_line画对角线------------------------------------------------
frame(wks)
end
但这样画出来,只出来散点图,没有对角线,求问错在什么地方?
多谢! |
|