爱气象,爱气象家园! 

气象家园

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博登陆

只需一步, 快速开始

搜索
查看: 6843|回复: 6

[作图] NCL曲线图标记

[复制链接]

新浪微博达人勋

发表于 2014-7-31 17:33:04 | 显示全部楼层 |阅读模式

登录后查看更多精彩内容~

您需要 登录 才可以下载或查看,没有帐号?立即注册 新浪微博登陆

x
  画图部分的脚本是这样的:

  plot=new(8,graphic)
  
  res@gsnYRefLineColor      = (/"transparent"/)
  res@gsnBelowYRefLineColor = (/"turquoise", "transparent", "transparent"/)
  res@gsnAboveYRefLineColor = (/"transparent", "transparent", "green"/)
  res@gsnYRefLine           = (/-0.5,0,0.5 /)
  
  res@xyLineColor      = "red"
  res@xyLineThicknesses = 3.0
  res@xyMarkLineModes = (/"MarkLines"/)    ; Markers *and* lines
  res@xyMarkers         = (/16/)                      ; choose type of marker  
  res@xyMarkerColors     = (/"red"/)                    ; Marker color
  res@xyMarkerSizeF     = 0.015                     ; Marker size (default 0.01)
  res@trYMaxF               = 3
  res@trYMinF               = -3
  res@gsnLeftString  = "OBS"
  res@gsnRightString = ""
  plot(0)  = gsn_csm_xy (wks,time,data(0,:),res) ; create plot


出来的图如下:
QQ截图20140731172944.png


有点小问题:为什么下面transparent的-0.5直线与曲线的交点也MarkLines了呢?我调了好久都没能去掉,请画过这类图的朋友指点一下,谢谢

密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2014-7-31 22:21:47 来自手机 | 显示全部楼层
我这边和你同样的情况,可能是bug,等有空看看源码!有个麻烦点的应急方法,就是用lines先画一次曲线,包括参考线及填充,然后再用marklines再单独画一次曲线。
密码修改失败请联系微信:mofangbao

新浪微博达人勋

 楼主| 发表于 2014-8-1 08:09:38 | 显示全部楼层
longlivehj 发表于 2014-7-31 22:21
我这边和你同样的情况,可能是bug,等有空看看源码!有个麻烦点的应急方法,就是用lines先画一次曲线,包括 ...

谢谢你的回复,我试试哈 谢谢
密码修改失败请联系微信:mofangbao

新浪微博达人勋

 楼主| 发表于 2014-8-1 09:10:26 | 显示全部楼层
longlivehj 发表于 2014-7-31 22:21
我这边和你同样的情况,可能是bug,等有空看看源码!有个麻烦点的应急方法,就是用lines先画一次曲线,包括 ...

版主你好 我试了下不行 可能是我脚本的问题 前面画的被覆盖了,请问如何做到不被覆盖?

;************************************************
; plotting parameters
;************************************************
  wks = gsn_open_wks("eps","KSum_Norm_Index4_2")

  res                      = True                      ; plot mods desired
  res@gsnDraw              = False
  res@gsnFrame             = False
  res@gsnMaximize          = False
   
  res@tmXBMinorOn           = True
  res@tmXBLabelFontHeightF  = 0.035
  res@tmYLLabelFontHeightF  = 0.035
  res@tmXBLabelFontThicknessF = 1.5
  res@tmYLLabelFontThicknessF = 1.5
  res@tmYLPrecision           = 2

  res@tmXBMode = "Explicit"
  res@tmXBValues = ispan(1979,2004,5)
  res@tmXBLabels = (/"1979","1984","1989","1994","1999","2004"/)
  res@tmXBMinorValues = ispan(1979,2005,1)
  res@vpWidthF            = 1.0           ; change aspect ratio of plot
  res@vpHeightF           = 0.6
  res@trXMaxF             = 2005
  res@trXMinF             = 1979

;  add a legend
;  res@pmLegendDisplayMode    = "Always"              ; turn on legend
;  res@pmLegendSide           = "Bottom"                 ; Change location of
;  res@lgLabelFontHeightF     = 0.03                   ; change font height
;  res@lgLabelFontThicknessF  = 1.5
;  res@lgPerimOn              = False                 ; no box around
  res@gsnLeftStringFontHeightF  = 0.035
  res@gsnRightStringFontHeightF = 0.035  

  plot=new(8,graphic)
  
  res@gsnYRefLineColor      = (/"transparent"/)
  res@gsnBelowYRefLineColor = (/"turquoise", "transparent", "transparent"/)
  res@gsnAboveYRefLineColor = (/"transparent", "transparent", "green"/)
  res@gsnYRefLine           = (/-0.5,0,0.5 /)
  res@xyLineColor      = "red"
  res@xyLineThicknesses = 3.0
  
  res@xyMarkLineModes = (/"Lines"/)    ; Markers *and* lines
; res@xyMarkers         = (/16/)                      ; choose type of marker  
; res@xyMarkerColors     = (/"red"/)                    ; Marker color
; res@xyMarkerSizeF     = 0.015                     ; Marker size (default 0.01)
  res@trYMaxF               = 3
  res@trYMinF               = -3
  res@gsnLeftString  = "OBS"
  res@gsnRightString = ""
  plot(0)  = gsn_csm_xy (wks,time,data(0,:),res) ; create plot
  
  res2                      = True                      ; plot mods desired
  res2@gsnDraw              = False
  res2@gsnFrame             = False
  res2@gsnMaximize          = False
   
  res2@tmXBMinorOn           = True
  res2@tmXBLabelFontHeightF  = 0.035
  res2@tmYLLabelFontHeightF  = 0.035
  res2@tmXBLabelFontThicknessF = 1.5
  res2@tmYLLabelFontThicknessF = 1.5
  res2@tmYLPrecision           = 2

  res2@tmXBMode = "Explicit"
  res2@tmXBValues = ispan(1979,2004,5)
  res2@tmXBLabels = (/"1979","1984","1989","1994","1999","2004"/)
  res2@tmXBMinorValues = ispan(1979,2005,1)
  res2@vpWidthF            = 1.0           ; change aspect ratio of plot
  res2@vpHeightF           = 0.6
  res2@trXMaxF             = 2005
  res2@trXMinF             = 1979   
  res2@gsnLeftStringFontHeightF  = 0.035
  res2@gsnRightStringFontHeightF = 0.035  
  res2@xyLineColor      = "red"
  res2@xyLineThicknesses = 3.0
  res2@xyMarkLineModes = (/"MarkLines"/)    ; Markers *and* lines
  res2@xyMarkers         = (/16/)                      ; choose type of marker  
  res2@xyMarkerColors     = (/"red"/)                    ; Marker color
  res2@xyMarkerSizeF     = 0.015                     ; Marker size (default 0.01)
  res2@trYMaxF               = 3
  res2@trYMinF               = -3
  plot(0)  = gsn_csm_xy (wks,time,data(0,:),res2) ; create plot

密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2014-8-1 09:30:02 来自手机 | 显示全部楼层
麦田_smile 发表于 2014-8-1 09:10
版主你好 我试了下不行 可能是我脚本的问题 前面画的被覆盖了,请问如何做到不被覆盖?

;************ ...

手机上网,不太好编辑脚本。大概看了下,就是这个意思。只是没有看到overlay语句。
参考http://www.ncl.ucar.edu/Applications/xy.shtml中第32个例子,先改改看。
密码修改失败请联系微信:mofangbao

新浪微博达人勋

 楼主| 发表于 2014-8-1 09:32:17 | 显示全部楼层
longlivehj 发表于 2014-8-1 09:30
手机上网,不太好编辑脚本。大概看了下,就是这个意思。只是没有看到overlay语句。
参考http://www.ncl. ...

原来还有overlay语句 非常感谢 谢谢!
密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2014-11-2 10:27:09 | 显示全部楼层
最好的方法就是把时间轴绘制得更长一点,留空白~
密码修改失败请联系微信:mofangbao
您需要登录后才可以回帖 登录 | 立即注册 新浪微博登陆

本版积分规则

Copyright ©2011-2014 bbs.06climate.com All Rights Reserved.  Powered by Discuz! (京ICP-10201084)

本站信息均由会员发表,不代表气象家园立场,禁止在本站发表与国家法律相抵触言论

快速回复 返回顶部 返回列表