gnuplot显示绘图中的实际数据(时间)

时间:2019-02-12 07:19:52

标签: gnuplot

我有一系列要绘制的数据。它每周一次。这是巨大的数据,所以我只是修剪了一些

data:

2018-11-01 02:00, 3.04, 9.10
2018-11-01 02:15, 3.56, 0.00
2018-11-01 02:30, 50.67, 0.00
2018-11-01 02:45, 50.67, 0.00
2018-11-01 03:00, 50.68, 0.00
2018-11-01 03:15, 50.68, 0.00
2018-11-01 03:30, 50.68, 0.00
2018-11-01 03:45, 50.70, 0.00
2018-11-01 04:00, 50.73, 0.00
2018-11-02 02:00, 2.97, 9.10
2018-11-02 02:15, 12.27, 0.00
2018-11-02 02:30, 44.29, 0.00
2018-11-02 02:45, 47.39, 0.00
2018-11-02 03:00, 47.44, 0.00
2018-11-02 03:15, 53.03, 0.00
2018-11-02 03:30, 54.75, 0.00
2018-11-02 03:45, 54.88, 0.00
2018-11-02 04:00, 66.90, 0.06
2018-11-03 02:00, 2.81, 9.06
2018-11-03 02:15, 12.13, 0.00
2018-11-03 02:30, 34.95, 0.00
2018-11-03 02:45, 34.96, 0.00
2018-11-03 03:00, 34.97, 0.00
2018-11-03 03:15, 34.98, 0.00
2018-11-03 03:30, 34.98, 0.00
2018-11-03 03:45, 34.99, 0.00
2018-11-03 04:00, 34.99, 0.00
2018-11-04 02:00, 47.48, 0.00
2018-11-04 02:15, 47.48, 0.00
2018-11-04 02:30, 47.48, 0.00
2018-11-04 02:45, 47.48, 0.00
2018-11-04 03:00, 47.47, 0.00
2018-11-04 03:15, 47.47, 0.00
2018-11-04 03:30, 47.47, 0.00
2018-11-04 03:45, 47.47, 0.00
2018-11-04 04:00, 47.47, 0.00

是否可以在每个图中显示实际时间? 应该在我的示例数据的第二列下显示时间。

这是我的代码:

APPNAME=$1
START=$2
END=$3
FILE=$4
gnuplot -persist <<-EOFMarker
set grid
set terminal png font 'helvetica,11.5' size 850,550
set output '$APPNAME.$START.$END.png' 
set title '$APPNAME $START.$END'  
set ylabel 'Percentage Usage'
set yrange [0:100]
set xlabel 'Client Time'
set xdata time
set timefmt "%Y-%m-%d"
set xrange ["$START":"$END"]
set format x "%m/%d"
set timefmt "%Y-%m-%d %H:%M"
set datafile separator ","
set x2label "Memory  = 60159 mb, SWAP = 4096 mb, Processor Count = 8"  ##change this if you will use for other application
unset label
set key top center box width 1 height 1 opaque
set style line 1 lt 1 lw 3 pt 3 linecolor rgb "red"
plot '$FILE' u 1:2 w lp t 'Memory', '$FILE' u 1:3 w lp t 'Swap'
EOFMarker

enter image description here

谢谢。

1 个答案:

答案 0 :(得分:0)

不确定,如果我理解正确的话。如果您有几天的数据,那么额外显示时间可能会变得越来越紧。

但是可以做到的: 将行set format x "%m/%d"换成set format x "%m/%d\n%H:%M",这也会在第二行显示时间。但我想可能没有足够的空间来显示比00:00和12:00更多的xtics。