Gnuplot日期时间格式不起作用

时间:2014-12-02 15:47:13

标签: gnuplot

以下为什么不起作用? (比较帖子底部的错误)

set terminal dumb
set style data lines

set datafile separator ","
set timefmt "%Y-%m-%d %H:%M:%S"

set xdata time
set xrange ['"2014-12-01 00:00:00"':'"2014-12-03 00:00:00"']

set format x "%m-%d\n%H:%M"

plot "<cat" using 1:2

数据:

2014-12-02 13:59:35,1
2014-12-02 13:59:57,2
2014-12-02 14:00:37,3
2014-12-02 14:00:43,4
2014-12-02 14:01:03,5
2014-12-02 14:01:22,6
2014-12-02 14:01:32,7
2014-12-02 14:01:37,8
2014-12-02 14:02:27,9
2014-12-02 14:04:18,10

输出:

Can't plot with an empty x range!

1 个答案:

答案 0 :(得分:1)

问题在于单引号内的双引号。你不需要他们两个。

set xrange ['2014-12-01 00:00:00':'2014-12-03 00:00:00']
plot "<cat" using 1:2

输出:

  10 ++-+--+--+--+--+--+-+--+--+--+--+--+--+--+--+--+--+--+-+*-+--+--+--+-++
     +        +        +       +        +        +"1.dat" using 1:2 ****** +
   9 ++                                                     *             ++
     |                                                      *              |
   8 ++                                                     *             ++
     |                                                      *              |
   7 ++                                                     *             ++
     |                                                      *              |
   6 ++                                                     *             ++
     |                                                      *              |
   5 ++                                                     *             ++
     |                                                      *              |
   4 ++                                                     *             ++
     |                                                      *              |
   3 ++                                                     *             ++
     |                                                      *              |
   2 ++                                                     *             ++
     +        +        +       +        +        +        + *     +        +
   1 ++-+--+--+--+--+--+-+--+--+--+--+--+--+--+--+--+--+--+-*--+--+--+--+-++
   12-01    12-01    12-01   12-01    12-02    12-02    12-02   12-02    12-03
   00:00    06:00    12:00   18:00    00:00    06:00    12:00   18:00    00:00