- 积分
- 6995
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2020-12-31
- 最后登录
- 1970-1-1
|
登录后查看更多精彩内容~
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
本帖最后由 穿越的小瓶子 于 2021-2-19 00:08 编辑
调用最基本的gsn_add_polymarker 绘制多个记号时出现了错误:
warning:TransformPostDraw: tfPolyDrawList element 0 is invalid warning:TransformPostDraw: tfPolyDrawList element 1 is invalid
为解决此问题,参考了官网:http://www.ncl.ucar.edu/Document ... dd_polymarker.shtml
通过摸索,具体的解释如下,如有错漏,恳请指正!!感激不尽!
[size=13.3333px]procedure add_markers(wks,plot,x,y,color) ;自定义函数,调用gsn_add_polymarker
[size=13.3333px]local pmres, str
[size=13.3333px]begin
[size=13.3333px]pmres = True
[size=13.3333px]pmres@gsMarkerColor = color ;
[size=13.3333px];pmres@gsMarkerIndex = type ;这里我省去了type,统一绘制同一种记号
[size=13.3333px]pmres@gsMarkerThicknessF = 1
[size=13.3333px]pmres@gsMarkerSizeF = 0.01
[size=13.3333px]mstring = "z" ;画实心红星——-特殊标号类型,类型查找见下方
[size=13.3333px]fontnum = 35 ;表格号
[size=13.3333px]xoffset = 0.0 ;x方向位置偏离情况
[size=13.3333px]yoffset = 0.0 ;y方向位置偏离情况
[size=13.3333px]ratio = 1.0 ;长宽比例,一般默认为1.0。
[size=13.3333px]size = 1.2 ;大小
[size=13.3333px]angle = 0.0 ;旋转情况
[size=13.3333px]new_index = NhlNewMarker(wks,mstring,fontnum,xoffset,yoffset,ratio,size,angle) ;新定义的index
[size=13.3333px]pmres@gsMarkerIndex = new_index
[size=13.3333px]str = unique_string("polymarker") ;返回独特数值,针对绘制多个记号尤其需要
[size=13.3333px]plot@$str$ = gsn_add_polymarker(wks, plot, x, y, pmres) ;绘制标记
[size=13.3333px]return(plot)
[size=13.3333px]end
然后在ncl主程序中引用add_markers函数:
yStation= (/31.7999/) ;纬度
xStation= (/118.9/) ;经度
colors = (/"red"/) ;颜色
add_markers(wks,plotmap(i),xStation,yStation,colors)
这样就完成了实心红星的标记【强迫症对空心红星实在难以忍受】
**********************************************************************
至于特殊的标记号,可以根据官网进行选择。
不同的表格(fontnum)在这里:http://www.ncl.ucar.edu/Document/Graphics/font_tables.shtml
各种特殊的符号主要集中在表格18-20,34-37。
点击进去可以根据左上方字符(mstring),选择对应的符号。
|
评分
-
查看全部评分
|