利用 gnuplot 绘制时间序列图
来源:互联网 发布:注册表修改mac地址 编辑:程序博客网 时间:2024/06/06 20:10
大名鼎鼎的 gnuplot 就不多介绍了。
通常我们利用数据文件绘图时,XY坐标的值都是实数,也就是我们要绘制图形的函数是R到R的映射。可有时横轴或纵轴的数据是时间值,时间的格式每次可能还都不太一样。这时我们就需要特殊设置一下 gnuplot了。
假设我们有数据文件“timedat.dat”,文件的内容如下。
#日/月/年 值01/06/9310017/08/9390004/10/93130011/10/9330028/10/931000
可以看到,横坐标是时间值,需要将这个信息告诉gnuplot。利用如下的命令。
set xdata time
类似的命令还包括:
set ydata timeset zdata timeset x2data timeset y2data timeset cbdata time
如果要回到原来的那种横坐标为数值的状态,可以执行如下命令:
set xdata
下面还需要告诉 gnuplot 数据文件中的时间格式是什么样,要利用如下的命令
set timefmt "<format string>"
其中format string 用来描述数据文件中时间的格式。对于我们的数据文件,可以这样设置:
set timefmt "%d/%m/%y"
Gnuplot 支持的格式如下:
格式
解释
%d
day of the month, 1–31
%m
month of the year, 1–12
%y
year, 0–99
%Y
year, 4-digit
%j
day of the year, 1–365
%H
hour, 0–24
%M
minute, 0–60
%s
seconds since the Unix epoch (1970-01-01 00:00 UTC)
%S
second, integer 0–60 on output, (double) on input
%b
three-character abbreviation of the name of the month
%B
name of the month
到这里就设置好了,下面开始显示
plot 'timedat.dat' using 1:2 with points ps 3 pt 6 title ""
输出的图形如下。
可以看到输出的横坐标只有月份和日期,没有年份信息。如果需要加入年份信息,可以这样设置:
set format x "%y/%m/%d"
然后更新一下输出:
Replot
这时的输出结果就满足我们的需求了。如果需要更细致的设置,请参考 gnuplot 的帮助文件。
- 利用 gnuplot 绘制时间序列图
- gnuplot 绘制时间序列图
- gnuplot 绘制时间序列图
- 利用 gnuplot 绘制时间序列图 http://blog.csdn.net/liyuanbhu/article/details/8497582
- Shell脚本利用gnuplot绘制图片
- 时序图的绘制—使用Gnuplot
- 一个x轴为时间的gnuplot图形绘制
- [gnuplot]使用gnuplot绘制Lattice
- gnuplot 绘制 柱状图
- GNUPlot绘制曲线
- gnuplot绘制csv数据
- gnuplot绘制圆
- gnuplot绘制文氏图
- 利用gnuplot画柱状图
- gnuplot绘制图像并保存
- 变动间距时间序列报表的绘制
- 利用R语言画简单时间序列图
- 【转】 利用gnuplot画柱状图
- C# ArrayList 类、Queue类、Stack类 集合
- 提高班2012年度总结感想
- C++ STL 应用点滴
- 追忆豆蔻年华
- struts1的拦截器(1.2)
- 利用 gnuplot 绘制时间序列图
- insmod: error inserting 'first_drv.ko': -1 Invalid module format
- 主流操作系统内核、操作系统以及它们之间的联系
- hdu 1087 Super Jumping! Jumping! Jumping!(dp+最长递增序列)
- kernel中断
- 再读HOG(梯度方向直方图)
- Combination Sum II
- 大学计算机网络复习题
- Android开发学习第一天