繁体   English   中英

Gnuplot上x轴上具有日期格式的堆积区域

[英]Stacked-area with date format at x-axis on Gnuplot

我已经使用filledcurves创建了图形。 现在,由于数据范围长,图形看起来很糟糕。 这是我的数据:

        a   b   c   d   e   f   g   h   i
201312  49  26  34  30  14  25  9   4   1
201311  38  22  47  30  9   9   4   3   1
201310  44  24  43  38  9   14  5   7   0
201309  65  18  33  39  15  12  4   5   1
201308  42  31  44  30  5   11  0   2   2
201307  58  27  35  29  8   4   2   4   2
201306  30  22  15  17  2   6   3   4   0
201305  61  52  20  16  11  12  2   3   0
201304  62  60  33  18  13  9   5   6   0
201303  43  53  49  27  9   11  7   0   0
201302  31  30  42  27  10  8   4   2   0
201301  42  30  20  47  9   13  3   2   1
201212  26  19  39  24  9   11  0   0   0
201211  26  26  30  28  1   2   0   2   1
201210  55  46  34  30  13  5   0   2   1
201209  56  31  27  28  27  13  2   4   1
201208  48  75  38  46  22  10  0   1   0
201207  60  56  37  47  19  11  2   1   0
201206  60  41  37  28  17  12  5   1   0
201205  49  43  38  46  15  16  2   2   0
201204  43  50  36  33  4   7   3   0   2
201203  49  63  35  43  16  7   1   2   0
201202  43  59  59  52  16  13  3   4   1
201201  51  44  30  37  20  9   4   1   0
201112  50  38  36  36  8   2   3   1   1
201111  75  35  30  36  16  7   3   3   1
201110  68  53  41  27  11  15  1   2   1
201109  68  46  48  47  16  19  4   0   1
201108  45  41  20  36  17  10  1   0   0
201107  48  34  30  24  13  7   3   3   1
201106  49  29  24  25  5   6   0   3   0
201105  45  35  21  37  1   7   2   1   0
201104  53  35  23  18  4   6   1   5   1
201103  58  42  20  18  6   4   1   0   4
201102  54  32  19  20  4   10  0   2   0
201101  42  41  21  28  3   6   1   2   1

这是我的gnuplot文件:

set terminal postscript eps color font 20
set xtics 1 out
set tics front
#set style fill transparent solid 0.5 noborder
set key below autotitle columnheader
set ylabel "Count"
set xlabel "across time"

set output 't1.eps'
set title "t1-Across time of Aspects"
set xtics 1
plot for [i=10:2:-1] \
"< awk 'NR==1 {print \"year\",$".(i-1)."} NR>=2 {for (i=2; i<=".i."; i++) \
{sum+= $i} {print $1, sum; sum=0} }' data.dat" \
using (column(2)):xtic(1) with filledcurves x1 t column(2)

当我在xdata中添加时间时:

 set xdata time set timefmt "%Y%m" set xtics format "%b" 

错误消息:

Need full using spec for x time data

错误是由于我的日期格式造成的吗? 我已经谷歌搜索,对此没有任何答案。 请给我建议。

在显示的脚本中,您仅在using语句中指定了一个列( xtic )。 就是说,该值作为y值,行号隐式用作x值。

使用时间数据时,必须明确指定绘图样式所需的所有列,并且不假设第一列可能是什么。 采用:

set key below autotitle columnheader
set ylabel "Count"
set xlabel "across time"
set tics front

set xdata time
set timefmt "%Y%m"
set xtics format "%b'%y"
set autoscale xfix

plot for [i=10:2:-1] \
"< awk 'NR==1 {print \"year\",$".(i-1)."} NR>=2 {for (i=2; i<=".i."; i++) \
{sum+= $i} {print $1, sum; sum=0} }' data.dat" \
using 1:2 with filledcurves x1 t column(2)

4.6.4的结果:

在此处输入图片说明

我想如果您有时间数据并指定x格式,则不需要xtic(1)

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM