【问题标题】:Issue with xrange in gnuplot 5.0.3gnuplot 5.0.3 中的 xrange 问题
【发布时间】:2020-01-23 20:51:31
【问题描述】:

我有一个输入文件 E3,其数据排列如下:

01/01/2020 00:00 15 0 39
01/01/2020 00:01 3 4 64
01/01/2020 00:02 0 24 9
...
01/07/2020 11:53 13 0 0
01/07/2020 11:54 19 2 20
01/07/2020 11:55 2 0 2

我正在尝试使用以下代码来绘制它:

set terminal x11 size 1900, 800
set term x11 1 noraise
set grid
set xlabel font "Times Roman, 22"
set xlabel "Date\nTime"
set xdata time
set timefmt "%m/%d/%Y %H:%M"
set xrange [ "01/01/2020 00:00" : "01/07/2020 11:55" ]
set format x "%m/%d\n%H:%M"
set xtics time
set y2label font "Times Roman, 22"
set y2label "Events"
set ytics 10
set y2tics 10
set key left top
plot './E3' using 0:3 with lines title "Delete" ls 15, './E3' using 0:4 with lines title "Failed" ls 4, './E3' using 0:5 with lines title "Update" ls 6
pause  -1

当我尝试让 gnuplot 运行上述程序时,它返回以下错误:

plot './E3' using 0:3 with lines title "Delete" ls 15, './E3' using 0:4 with lines title "Failed" ls 4, './E3' using 0:5 with lines title "Update" ls 6

                                                    ^
"enum.gnu.1", line 18: all points y value undefined!

注释掉集合 xrange 可以消除错误。但是,在图中,x 轴上的抽动是 01/01\n00:00, 01/01\n00:15, ... 01:01\n02:45 - 这不是我想要的。我想要的是每天都有一个 x tic - 对应于 1440 个数据点 - 每个 tic 都标有日期和时间。 IE。 01/01\n00:00, 01/02\n00:00, ... 01/07\n00:00.

我做错了什么?

【问题讨论】:

    标签: gnuplot


    【解决方案1】:

    首先,您为什么要绘制列0 而不是1? 接下来,数据/时间在内部以秒为单位计数。所以,如果你想要每天 tic 一次,你必须将它设置为 60*60*24 秒。

    如果您更改以下行,它应该可以工作:

    set xtics 60*60*24 time
    

    plot $Data using 1:3 with lines title "Delete" ls 15, \
         '' using 1:4 with lines title "Failed" ls 4, \
         '' using 1:5 with lines title "Update" ls 6
    

    【讨论】:

    • 很高兴它可以工作。如果此答案对您有帮助或解决了您的问题,请将其标记为此类。
    猜你喜欢
    • 1970-01-01
    • 2014-06-25
    • 2016-01-31
    • 2018-07-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-05-23
    相关资源
    最近更新 更多