用gnuplot画双轴曲线时序图

时序图是常见的一种数据绘图,要画出类似excel中的双y坐标轴曲线图,可以在gnuplot如此处理:

set xdata time
set xlabel ‘ ‘
set timefmt “%Y-%m”
set grid
set y2range [0:50]
set ylabel ‘Datasets’
set y2label ‘Orders’
set timefmt “%Y-%m”
set xrange [‘2010-08′:’2012-12’]
set format x ‘%Y-%m’
set xtics nomirror rotate by -45
plot “water-service.txt” using 1:2 smooth csplines lw 2 lc rgb ‘red’ title ‘Datasets’,” u 1:2 w points pt 4 lc rgb ‘red’ t ”, ” using 1:3 axes x1y2 smooth csplines lc rgb ‘blue’ title ‘Orders’, ” u 1:3 axes x1y2 w points pt 4 lc rgb ‘blue’ t ”

数据如下:

2010-8 7 4
2010-9 1 1
2010-10 6 4
2010-11 26 9
2010-12 12 6
2011-1 28 10
2011-2 9 3
2011-3 94 33
2011-4 30 13
2011-5 21 9
2011-6 50 14
2011-7 49 16
2011-8 20 8
2011-9 46 16
2011-10 37 14
2011-11 50 15
2011-12 15 9
2012-1 14 6
2012-2 47 13
2012-3 17 12
2012-4 7 5
2012-5 37 11
2012-6 23 9
2012-7 5 3
2012-8 30 9
2012-9 66 19
2012-10 32 12
2012-11 20 6
2012-12 55 17


已发布

分类

,

来自

标签:

评论

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注