Example 1 - XY plots
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
Example 1 - XY plots的更多相关文章
- NumPy for MATLAB users
http://mathesaurus.sourceforge.net/matlab-numpy.html Help MATLAB/Octave Python Description dochelp - ...
- Fluent 18.0新功能之:其他
ANSYS 18.0在2017年1月底发布,来看看Fluent18.0更新了哪些内容. 1 用户界面 关于用户界面方面的更新包括: (1)可以在树形菜单中同时选择多个子节点,如同时选择多个边界,点击右 ...
- Matplotlib外观和基本配置笔记
title: matplotlib 外观和基本配置笔记 notebook: Python tags:matplotlib --- 参考资料,如何使用matplotlib绘制出数据图形,参考另一篇mat ...
- Open Source GIS and Freeware GIS Applications
Open Source GIS and Freeware GIS Applications An open source application by definition is software ...
- Bugku-CTF分析篇-抓到一只苍蝇(在哪?here!卧槽?!好大一坨苍蝇。)
抓到一只苍蝇 抓到一只苍蝇 本题要点:pcapng包导出文件.合并连续的pcapng包.rar文件头.binwalk基本使用.foremost安装及使用 下载完成后,发现有这样 ...
- matplotlib 入门之Sample plots in Matplotlib
文章目录 Line Plot One figure, a set of subplots Image 展示图片 展示二元正态分布 A sample image Interpolating images ...
- LightningChart解决方案:XY和3D图表(Polymer Char GPC-IR®-工程案例)
LightningChart解决方案:XY和3D图表(Polymer Char GPC-IR-工程案例) 所在行业:石化公司成立时间:1992年LightningChart解决方案:XY和3D图表 P ...
- 第三方登录插件.NET版XY.OAuth-CSharp
XY.OAuth-CSharp GitHub:XY.OAuth-CSharp OSChina:XY.OAuth-CSharp 第三方登录插件.NET版 使用 首先,从NuGet上安装"XY. ...
- ArcEngine :The XY domain on the spatial reference is not set or invalid错误
在创建数据集的时候,提示The XY domain on the spatial reference is not set or invalid错误. 原因:未设置空间参考(ISpatialRefer ...
随机推荐
- webcat——基于netty的http和websocket框架
代码地址如下:http://www.demodashi.com/demo/12687.html Webcat是一个基于netty的简单.高性能服务端框架,目前提供http和websocket两种协议的 ...
- sql server 执行大.sql文件
打开cmd执行:osql -S 127.0.0.1 -U sa -P sa -i d:\test.sql 执行后会提示输入密码.
- MQTT--topic
1.topic 定阅与发布必须要有主题,只有当定阅了某个主题后,才能收到相应主题的payload,才能进行通信. 2. 主题层级分隔符—“/” 主题层级分隔符使得主题名结构化.如果存在分隔符,它将 ...
- Spring学习一----------Spring概况
© 版权声明:本文为博主原创文章,转载请注明出处 Spring概况 Spring是为了解决企业应用开发的复杂性而创建的. Spring是一种轻量级的控制反转(IOC)和面向切面(AOP)的容器框架. ...
- 借助Anyproxy实时监控接口调用次数和流量
监控接口调用次数,是为了测试客户端可能会异常频繁的调用服务端接口,出现性能问题. AnyProxy是一个开放式的HTTP代理服务器. github: https://github.com/alibab ...
- 第八章 委托,lamdbda 表达式和事件
第八章 委托,lamdbda 表达式和事件 委托是寻址方式的.net版本. 委托是类型安全的类,它定义了返回类型和参数的类型.委托类不仅包含方法的应用,也可以包含对多个方法的引用. 在 C++中,函数 ...
- MVC进阶学习--View和Controller之间的数据传递(一)
1.使用ViewData ViewData 的是ControllerBase 的一个属性,是一个数据字典类型的,其实现代码如(这段代码来自asp.net MVC开源项目中源码)下: Code 1 ...
- printf()与 scanf()
一直以来就没有认真看过控制台输入输出的格式,现今找了一些材料,分享如下: 1. 格式化规定符 Turbo C2.0提供的格式化规定符如下: ━━━━━━━━━━━━━━━━━━━━━━━━━━ ...
- kafka官方Quick Start
1.下载kafka,并上传到服务器 2.如果之前没安装zookeeper,这里可以启动一个简单的zookeeper bin/zookeeper-server-start.sh config/zooke ...
- android.util.AndroidRuntimeException Calling startActivity() from outside of an Activity context requires the FLAG_ACTIVITY_NEW_TASK flag. Is this really what you want? com.uethinking.microvideo.manag
记录学习,网络摘抄 碰到这个异常其实这个上面说的很清楚,加个flag 从一个Activity中要通过intent调出另一个Activity的话,需要使用 FLAG_ACTIVITY_NEW_TASK ...




