- 积分
- 4047
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2013-11-12
- 最后登录
- 1970-1-1
|
登录后查看更多精彩内容~
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
本帖最后由 悠然一梦123 于 2016-5-19 08:50 编辑
3个Y轴,左侧3个变量,右侧3个变量,最右侧一个变量,想在7条折线上均做标记,可出来的图只有三条线有标记,有标记的均是各个Y轴上的第一个变量,请问,该怎么办,下面是我的脚本。已解决!
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"
begin
data=asciiread("lan 3.csv",(/72,8/),"float")
x=data(:,0)
y1=data(:,1)
y2=data(:,2)
y3=data(:,3)
y4=data(:,4)
y5=data(:,5)
y6=data(:,6)
y7=data(:,7)
data_all1=new((/3,72/),float)
data_all2=new((/3,72/),float)
data_all3=new((/1,72/),float)
data_all1(0,:)=y1
data_all1(1,:)=y3
data_all1(2,:)=y4
data_all2(0,:)=y2
data_all2(1,:)=y5
data_all2(2,:)=y6
data_all3(0,:)=y7
wks = gsn_open_wks("pdf","xy")
res1 = True
res2 = True
res3 = True
res1@tiXAxisString= "Hour(h)"
res1@tiYAxisString ="AQI/O3/PM10(ppmv)"
res2@tiYAxisString = "PM2.5/SO2/NO2(ppmv)"
res3@tiYAxisString = "CO(ppmv)"
res1@xyMonoDashPattern=True
res2@xyMonoDashPattern=True
res3@xyMonoDashPattern=True
res1@xyLineColors =(/"purple","khaki4","black"/)
res2@xyLineColors = (/ "green","blue","brown"/)
res3@xyLineColors = "red"
res1@xyMarkLineModes="MarkLines"
res1@xyMarkers = (/16,16,16/)
res1@xyMarkerColors =(/"purple","khaki4","black"/)
res2@xyMarkLineModes="MarkLines"
res2@xyMarkers = (/16,16,16/)
res2@xyMarkerColors =(/ "green","blue","brown"/)
res3@xyMarkLineModes="MarkLines"
res3@xyMarkers = 16
res3@xyMarkerColors = "red"
plot= gsn_csm_xy3(wks,x,data_all1,data_all2,data_all3,res1,res2,res3)
lgres = True
lgres@lgLineColors = (/"purple","khaki4","black","green","blue","brown","red"/)
lgres@lgItemType = "Lines" ; show lines only (default)
lgres@lgLabelFontHeightF = .045 ; legend label font thickness
lgres@vpWidthF = 0.1 ; width of legend (NDC)
lgres@vpHeightF = 0.09 ; height of legend (NDC)
lgres@lgMonoDashIndex = True
lgres@lgDashIndex = 0
lgres@lgPerimOn = False ; turn off box around
labels = (/"AQI","O3","PM10","PM2.5","SO2","NO2","CO"/)
nitems = dimsizes(labels) ; number of legend items
lbid = gsn_create_legend(wks,nitems,labels,lgres)
amres = True
amres@amJust = "BottomCenter"
amres@amParallelPosF = -0.43 ; Move legend to right
amres@amOrthogonalPosF = -0.18 ; Move legend down.
annoid = gsn_add_annotation(plot,lbid,amres) ; add legend to plot
psres = True
maximize_output(wks,psres) ; calls draw and frame for you
end
好吧,刚已找到问题,原来res1@xyMarkLineModes="MarkLines"应该写成res2@xyMarkLineModes=(/"MarkLines","MarkLines","MarkLines"/),标记几条线后面就该写上几个"MarkLines“。出来的图如下。
|
-
-
|