爱气象,爱气象家园! 

气象家园

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博登陆

只需一步, 快速开始

搜索
查看: 5397|回复: 0

ncl的legend创建

[复制链接]

新浪微博达人勋

发表于 2017-3-24 14:14:01 | 显示全部楼层 |阅读模式
NCL
系统平台:
问题截图:
问题概况: 利用gsn_create_legend自动生成的图片,线条和文字对应出了些偏差
我看过提问的智慧: 看过
自己思考时长(天): 3

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

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

x
opts = xyres
   wks = gsn_open_wks("png","d04")
   gsn_define_colormap(wks,"default")
   base = gsn_csm_xy(wks,xtaus,transpose(D04),opts)
   ncol = 3
   nrow = toint(ceil(tofloat(nsite)/ncol))
   lgres2 = lgres
   amres2 = amres
   lgres2@vpHeightF     = lgres@vpHeightF*nrow
   amres2@amOrthogonalPosF = amres@amOrthogonalPosF+lgres2@vpHeightF
   mkmode2 = array_append_record(mkmode,mkmode,0)
   lnmode2 = array_append_record(lnmode,lnmode,0)
   colors2 = array_append_record(colors,colors,0)
   labels2 = array_append_record(site,site,0)
   colors2(nsite:) = 0
   labels2(nsite:) = ""
   do i = 0, ncol-1
      label = unique_string("label")
      annot = unique_string("annot")
      index = ispan(0,nrow-1,1)+nrow*i
      lgres2@lgMarkerIndexes = mkmode2(index)
      lgres2@lgMarkerColors  = colors2(index)
      lgres2@lgDashIndexes   = lnmode2(index)
      lgres2@lgLineColors    = colors2(index)
      lgres2@lgItemOrder     = ispan(nrow-1,0,1)
      base@$label$ = gsn_create_legend(wks,nrow,labels2(index(::-1)),lgres2)
      base@$annot$ = gsn_add_annotation(base,base@$label$,amres2)
      amres2@amParallelPosF  = amres2@amParallelPosF+lgres2@vpWidthF*1.2
   end do
   gsn_panel(wks,base,(/1,1/),plres)
   delete(opts)


密码修改失败请联系微信:mofangbao
您需要登录后才可以回帖 登录 | 立即注册 新浪微博登陆

本版积分规则

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

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

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