http://www.ncl.ucar.edu/Document/Manuals/Getting_Started/Examples/gsun01n.shtml
Frame 1 Frame 2 Frame 3 Frame 4 Frame 5

(Click on any frame to see it enlarged.)


NCL code for example 1

  1. load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"  ; 加载包含gsn_的函数的ncl文件
3. begin ;程序开始
4. x = new(9,float) ; 定义一个包含有9个元素的一维数组(c = new((/5,6,7/),integer) a= (/True,False,True/))
5. y = new(9,float)
6.
7. x = (/10.,20.,30.,40.,50.,60.,70.,80.,90./)
8. y = (/0.,0.71,1.,0.7,0.002,-0.71,-1.,-0.71,-0.003/)
9.
10. wks = gsn_open_wks("x11","gsun01n") ; 打开一个X11的工作站
11.
12. plot = gsn_xy(wks,x,y,False) ; 绘制一个xy的曲线图
13.
14. ;----------- Begin second plot -----------------------------------------
15.
16. y2 = (/(/0., 0.7, 1., 0.7, 0., -0.7, -1., -0.7, 0./),\
17. (/2., 2.7, 3., 2.7, 2., 1.3, 1., 1.3, 2./),\
18. (/4., 4.7, 5., 4.7, 4., 3.3, 3., 3.3, 4./)/) ;这是一个27个元素的一维数组
19.
20. x@long_name = "X" ; 定义x的一个属性
21. y2@long_name = "Y" ; 定义y2的一个属性
22.
23. plot = gsn_xy(wks,x,y2,False) ; 绘制一个包含3个曲线的xy plot
24.
25. ;----------- Begin third plot -----------------------------------------
26.
27. resources = True ; 示意有资源要设置
29.
30. resources@xyLineColors = (/2,3,4/) ; 设定线条颜色
31. resources@xyLineThicknesses = (/1.,2.,5./) ; 设定线条粗细
32. ; (默认值是1.0).
33.
34. plot = gsn_xy(wks,x,y2,resources) ; 绘制一个 XY plot.
35.
36. ;---------- Begin fourth plot ------------------------------------------
37.
38. resources@tiMainString = "X-Y plot" ; 标题
39. resources@tiXAxisString = "X Axis" ; x轴标签
40. resources@tiYAxisString = "Y Axis" ; y轴标签
41. resources@tiMainFont = "Helvetica" ; 标题字体
42. resources@tiXAxisFont = "Helvetica" ; x轴标签字体
43. resources@tiYAxisFont = "Helvetica" ; y轴标签字体
44.
45. resources@xyMarkLineModes = (/"Lines","Markers","MarkLines"/)
46. resources@xyMarkers = (/0,1,3/) ; (none, dot, asterisk)
47. resources@xyMarkerColor = 3 ; 标记颜色
48. resources@xyMarkerSizeF = 0.03 ; 标记大小
49. ; 默认是0.01
50.
51. plot = gsn_xy(wks,x,y2,resources) ; 绘制一个 XY plot.
52.
53. ;---------- Begin fifth plot ------------------------------------------
54.
55. filename = "$NCARG_ROOT/lib/ncarg/data/asc/xy.asc"
56.
57. data = asciiread(filename,(/129,4/),"float") ;以浮点读取参数文件入data,data数组规格:(/129,4/)
58.
59. uv = new((/2,129/),float)
60. uv(0,:) = data(:,1)
61. uv(1,:) = data(:,2)
62.
63. lon = data(:,0)
64. lon = (lon-1) * 360./128.
65.
66. delete(resources) ; 删除之前设置的资源
67.
68. resources = True
69.
70. resources@tiMainString = "U/V components of wind"
71. resources@tiXAxisString = "longitude"
72. resources@tiYAxisString = "m/s"
73. resources@tiXAxisFontHeightF = 0.02 ; 改变字体大小
74. resources@tiYAxisFontHeightF = 0.02
75.
76. resources@xyLineColors = (/3,4/) ; 设置线条颜色
77. resources@xyLineThicknessF = 2.0 ; 线条粗细设置为原来2倍
78.
79. resources@xyLabelMode = "Custom" ; 设置曲线标签
80. resources@xyExplicitLabels = (/"U","V"/) ; 曲线标签
81. resources@xyLineLabelFontHeightF = 0.02 ; 大小和颜色
82. resources@xyLineLabelFontColor = 2 ; 线条标签
83.
84. plot = gsn_xy(wks,lon,uv,resources) ; 绘制2个曲线的xy plot
85.
86. delete(plot) ; 清空绘制面板
87. delete(resources) ; 删除资源
88. end

最新文章

  1. mysql查询语句select-子查询
  2. final的使用
  3. 【数据结构】DFS求有向图的强连通分量
  4. 在windows系统的文件右键菜单中增加“命令提示符”
  5. Modify textures at runtime
  6. Remove Linked List Elements
  7. [UWP]一种利用Behavior 将StateTrigger集中管理的方案
  8. python之时间函数
  9. 操作失败,没有该服务权限![ 机构号:99 ,用户ID:50000009 ,服务号:0101030112 ]
  10. win7 IIS7.0 【IIS 管理器无法验证此内置帐户是否有访问权】
  11. AIM Tech Round 3 (Div. 2)D. Recover the String(贪心+字符串)
  12. 高效搭建lnmp环境
  13. Spring Boot实战笔记(一)-- Spring简介
  14. Java 学习笔记 两大集合框架Map和Collection
  15. html:布局class名和其他class名个人整理总结
  16. dskinlite(uieasy mfc界面库)使用记录1: schema验证xml
  17. Beginning SDL 2.0(3) SDL介绍及BMP渲染
  18. Three.js入门篇(一)创建一个场景
  19. Linux常用网络工具:路由扫描之mtr
  20. odoo 的一些orm 操作

热门文章

  1. javascript继承—prototype最优两种继承(空函数和循环拷贝)
  2. UIView的endEditing:方法
  3. the reactor pattern and java nio
  4. 我最喜欢的模板jade(pug)学习和使用
  5. Shell计算器
  6. zabbix api调用
  7. centos root登录password 忘记解决的方法
  8. Caused by: com.mysql.jdbc.MysqlDataTruncation: Data truncation: Incorrect datetime value: '' for column 'createtime' at row 1...
  9. 利用socket.io实现消息实时推送
  10. 对无向图的深度优先搜索(DFS)